Sitelet https://github.com/woven-by-toyota/go-zserio
Skip to content
woven-by-toyotaPublic

About

zserio support for Go

Topics

Resources

Contributing

Security policy

Stars

13 stars

Watchers

3 watching

Forks

Latest commit

 

History

374 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Go Reference Build Status

go-zserio

zserio code generation in Go.

Versioning

go-zserio is still in active development, and not completely stable yet. Until the first stable release all versions will have a major version number of 0. The minor version number will be updated for (API) breaking changes.

Usage

First you need to install the go-zserio command:

go install github.com/woven-planet/go-zserio/cmd/go-zserio@latest

With this command you can generate the Go interface files to read/write zserio:

go-zserio generate <zserio_directory> --rootpackage <root_package> --out <output_directory>

This command compiles the zserio files, and generates Go files to read and write zserio encoded data. zserio_directory is the directory where the zserio definitions are stored. Supported file extensions are .zs and .zserio. rootpackage specifies the root package name of the generated Go files. output_directory specifies the path where the Go files will be generated.

Memory allocation

When reading arrays, strings and bytes (blobs) zserio defaults to not allocate more memory than a configurable maximum. This is a safety measure to prevent allocating all memory and entering an out-of-memory state if the input has invalid sizes data. This could happen when dealing with untrusted or corrupted input. This behavior can be controlled using environment variables.

Environment variable Default Description
ZSERIO_MAX_INITIAL_ARRAY_SIZE 1000 Maximum initial capacity for arrays
ZSERIO_MAX_INITIAL_BLOB_SIZE 102400 (100kB) Maximum initial capacity of bytes and strings

Setting an environment variable to 0 removes the maximum, which can result in a small performance gain. This should only be done when the input is trusted.

Limitations

  • Implicit length arrays are deprecated, and are not supported.
  • The ternary operator only works when used in functions.
  • Cyclic imports, while not recommended, are supported by zserio, but not supported by go-zserio.
  • Offsets and indexed offsets are not implemented yet.
  • Constraints are not implemented yet.
  • The bazel run //internal/parser:update command to rerun the antlr parser does not work on Windows. See #128 for more details.

Links

About

zserio support for Go

Topics

Resources

Contributing

Security policy

Stars

13 stars

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages