Documentation ¶
Overview ¶
Package schemas provides a container for Cap'n Proto reflection data. The code generated by capnpc-go will register its schema in the default registry (unless disabled at generation time).
Most programs will use the default registry. However, a program could dynamically build up a registry, perhaps by invoking the capnp tool or querying a service.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Find ¶
Find returns the CodeGeneratorRequest message for the given ID, suitable for capnp.Unmarshal, or nil if the ID was not found. It is safe to call Find from multiple goroutines, so the returned byte slice should not be modified. However, it is not safe to call Find concurrently with Register.
func IsNotFound ¶
IsNotFound reports whether e indicates a failure to find a schema.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
A Registry is a mapping of IDs to schema blobs. It is safe to read from multiple goroutines. The zero value is an empty registry.
var DefaultRegistry Registry
DefaultRegistry is the process-wide registry used by Register and Find.
type Schema ¶
type Schema struct { // Either String or Bytes must be populated with a CodeGeneratorRequest // message in the standard Cap'n Proto framing format. String string Bytes []byte // If true, the input is assumed to be zlib-compressed and packed. Compressed bool // Node IDs that are contained in this schema. Nodes []uint64 }
A Schema is a collection of schema nodes parsed by the capnp tool.