Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CompressionExtendedCommitCodec ¶
type CompressionExtendedCommitCodec struct {
// contains filtered or unexported fields
}
CompressionExtendedCommitCodec is a ExtendedCommitCodec that uses compression to encode / decode, given a ExtendedCommitCodec that can encode / decode uncompressed extended commit info.
func NewCompressionExtendedCommitCodec ¶
func NewCompressionExtendedCommitCodec(codec ExtendedCommitCodec, compressor Compressor) *CompressionExtendedCommitCodec
NewCompressionExtendedCommitCodec returns a new CompressionExtendedCommitCodec given an underlying codec.
func (*CompressionExtendedCommitCodec) Decode ¶
func (codec *CompressionExtendedCommitCodec) Decode(bz []byte) (cometabci.ExtendedCommitInfo, error)
Decode decompresses the extended commit info using zstd and then decodes the result using the codec's Decode method.
func (*CompressionExtendedCommitCodec) Encode ¶
func (codec *CompressionExtendedCommitCodec) Encode(extendedCommitInfo cometabci.ExtendedCommitInfo) ([]byte, error)
Encode returns the encoded extended commit info using the codec's Encode method and then compresses the result. This implementation uses zstd compression.
type CompressionVoteExtensionCodec ¶
type CompressionVoteExtensionCodec struct {
// contains filtered or unexported fields
}
CompressionVoteExtensionCodec is a VoteExtensionCodec that uses compression to encode / decode, given a VoteExtensionCodec that can encode / decode uncompressed vote extensions.
func NewCompressionVoteExtensionCodec ¶
func NewCompressionVoteExtensionCodec(codec VoteExtensionCodec, compressor Compressor) *CompressionVoteExtensionCodec
NewCompressionVoteExtensionCodec returns a new CompressionVoteExtensionCodec given an underlying codec.
func (*CompressionVoteExtensionCodec) Decode ¶
func (codec *CompressionVoteExtensionCodec) Decode(bz []byte) (vetypes.OracleVoteExtension, error)
Decode decompresses the vote extension using zstd and then decodes the result using the codec's Decode method.
func (*CompressionVoteExtensionCodec) Encode ¶
func (codec *CompressionVoteExtensionCodec) Encode(ve vetypes.OracleVoteExtension) ([]byte, error)
Encode returns the encoded vote extension using the codec's Encode method and then compresses the result. This implementation uses zstd compression.
type Compressor ¶
type DefaultExtendedCommitCodec ¶
type DefaultExtendedCommitCodec struct{}
DefaultExtendedCommitCodec is the default implementation of ExtendedCommitCodec. It uses the vanilla implementations of Unmarshal / Marshal under the hood
func NewDefaultExtendedCommitCodec ¶
func NewDefaultExtendedCommitCodec() *DefaultExtendedCommitCodec
NewDefaultExtendedCommitCodec returns a new DefaultExtendedCommitCodec.
func (*DefaultExtendedCommitCodec) Decode ¶
func (codec *DefaultExtendedCommitCodec) Decode(bz []byte) (cometabci.ExtendedCommitInfo, error)
func (*DefaultExtendedCommitCodec) Encode ¶
func (codec *DefaultExtendedCommitCodec) Encode(extendedCommitInfo cometabci.ExtendedCommitInfo) ([]byte, error)
type DefaultVoteExtensionCodec ¶
type DefaultVoteExtensionCodec struct{}
DefaultVoteExtensionCodec is the default implementation of VoteExtensionCodec. It uses the vanilla implementations of Unmarshal / Marshal under the hood
func NewDefaultVoteExtensionCodec ¶
func NewDefaultVoteExtensionCodec() *DefaultVoteExtensionCodec
NewDefaultVoteExtensionCodec returns a new DefaultVoteExtensionCodec.
func (*DefaultVoteExtensionCodec) Decode ¶
func (codec *DefaultVoteExtensionCodec) Decode(bz []byte) (vetypes.OracleVoteExtension, error)
func (*DefaultVoteExtensionCodec) Encode ¶
func (codec *DefaultVoteExtensionCodec) Encode(ve vetypes.OracleVoteExtension) ([]byte, error)
type ExtendedCommitCodec ¶
type ExtendedCommitCodec interface { // Encode encodes the extended commit info into a byte array. Encode(cometabci.ExtendedCommitInfo) ([]byte, error) // Decode decodes the extended commit info from a byte array. Decode([]byte) (cometabci.ExtendedCommitInfo, error) }
ExtendedCommitCodec is the interface for encoding / decoding extended commit info.
type VoteExtensionCodec ¶
type VoteExtensionCodec interface { // Encode encodes the vote extension into a byte array. Encode(ve vetypes.OracleVoteExtension) ([]byte, error) // Decode decodes the vote extension from a byte array. Decode([]byte) (vetypes.OracleVoteExtension, error) }
VoteExtensionCodec is the interface for encoding / decoding vote extensions.
type ZLibCompressor ¶
type ZLibCompressor struct{}
ZLibCompressor is a Compressor that uses zlib to compress / decompress byte arrays, this object is not thread-safe.
func NewZLibCompressor ¶
func NewZLibCompressor() *ZLibCompressor
NewZLibCompressor returns a new zlibDecompressor.
func (*ZLibCompressor) Compress ¶
func (c *ZLibCompressor) Compress(bz []byte) ([]byte, error)
Compress compresses the given byte array using zlib. It returns an error if the compression fails. This function is not thread-safe, and uses zlib.BestCompression as the compression level.
func (*ZLibCompressor) Decompress ¶
func (c *ZLibCompressor) Decompress(bz []byte) ([]byte, error)
Decompress decompresses the given byte array using zlib. It returns an error if the decompression fails.
type ZStdCompressor ¶
type ZStdCompressor struct{}
ZStdCompressor is a Compressor that uses zstd to compress / decompress byte arrays, this object is thread-safe.
func NewZStdCompressor ¶
func NewZStdCompressor() *ZStdCompressor
func (*ZStdCompressor) Decompress ¶
func (c *ZStdCompressor) Decompress(bz []byte) ([]byte, error)