Skip to main content

proto

Package proto provides Protocol Buffer encoding, decoding, and introspection for durable programs. proto is registered as a predeclared global (not a load entry), so it is used directly without a load() statement.

proto.package(...)

proto​

Copyright 2018 The Skycfg Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
SPDX-License-Identifier: Apache-2.0
proto is registered as a predeclared global (not a load entry), so it is
used directly without a load() statement.
proto.package(...)

Functions​

file_registry(data: Bytes)​

Example:

registry = proto.file_registry(contracts_data)

Parameters:

NameTypeRequiredDescription
dataBytes✓

Returns: FileRegistry


clear(msg: Message)​

Example:

proto.clear(my_message)

Parameters:

NameTypeRequiredDescription
msgMessage✓

Returns: Message


clone(msg: Message)​

Example:

copy = proto.clone(my_message)

Parameters:

NameTypeRequiredDescription
msgMessage✓

Returns: Message


encode_any(msg: Message)​

Example:

any_msg = proto.encode_any(my_message)

Parameters:

NameTypeRequiredDescription
msgMessage✓

Returns: Message


merge(dst: Message, src: Message)​

Example:

proto.merge(dst, src)

Parameters:

NameTypeRequiredDescription
dstMessage✓
srcMessage✓

Returns: Message


set_defaults(msg: Message)​

Example:

proto.set_defaults(my_message)

Parameters:

NameTypeRequiredDescription
msgMessage✓

Returns: Message


package(name: String, contracts: FileRegistry)​

Example:

pkg = proto.package("acme.v1", registry)

Parameters:

NameTypeRequiredDescription
nameString✓
contractsFileRegistry✓

Returns: Package


Types​

EnumType​


FileRegistry​


Message​


MessageDescriptor​


Package​


ServiceDescriptor​