block_mock

package
v0.53.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 5, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExampleBlock

func NewExampleBlock() block.Block

NewExampleBlock builds a new example block.

func NewMockStore

func NewMockStore(hashType hash.HashType) block.StoreOps

NewMockStore constructs a new mock bucket for testing.

hashType is the hash type to use, 0 for default.

func NewRootBlock

func NewRootBlock() block.Block

NewRootBlock constructs a new root block.

func NewSubBlockBlock

func NewSubBlockBlock() block.Block

NewSubBlockBlock constructs a SubBlock as a Block.

Types

type Example

type Example struct {

	// Msg is a message.
	Msg string `protobuf:"bytes,1,opt,name=msg,proto3" json:"msg,omitempty"`
	// contains filtered or unexported fields
}

Example is the value pointed to by ExamplePtr.

func NewExample

func NewExample(msg string) *Example

NewExample builds a new example block with a message.

func UnmarshalExample

func UnmarshalExample(ctx context.Context, bcs *block.Cursor) (*Example, error)

UnmarshalExample unmarshals the example block. Returns nil, nil if empty

func (*Example) CloneMessageVT

func (m *Example) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Example) CloneVT

func (m *Example) CloneVT() *Example

func (*Example) DecodedBlockCacheTypeKey added in v0.51.7

func (e *Example) DecodedBlockCacheTypeKey() string

DecodedBlockCacheTypeKey returns the decoded-block cache type key.

func (*Example) EqualMessageVT

func (this *Example) EqualMessageVT(thatMsg any) bool

func (*Example) EqualVT

func (this *Example) EqualVT(that *Example) bool

func (*Example) GetMsg

func (x *Example) GetMsg() string

func (*Example) MarshalBlock

func (e *Example) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*Example) MarshalJSON

func (x *Example) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Example to JSON.

func (*Example) MarshalProtoJSON

func (x *Example) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Example message to JSON.

func (*Example) MarshalProtoText

func (x *Example) MarshalProtoText() string

func (*Example) MarshalToSizedBufferVT

func (m *Example) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Example) MarshalToVT

func (m *Example) MarshalToVT(dAtA []byte) (int, error)

func (*Example) MarshalVT

func (m *Example) MarshalVT() (dAtA []byte, err error)

func (*Example) ProtoMessage

func (*Example) ProtoMessage()

func (*Example) Reset

func (x *Example) Reset()

func (*Example) SizeVT

func (m *Example) SizeVT() (n int)

func (*Example) String

func (x *Example) String() string

func (*Example) UnmarshalBlock

func (e *Example) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*Example) UnmarshalJSON

func (x *Example) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Example from JSON.

func (*Example) UnmarshalProtoJSON

func (x *Example) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Example message from JSON.

func (*Example) UnmarshalVT

func (m *Example) UnmarshalVT(dAtA []byte) error

type Root

type Root struct {

	// ExampleSubBlock is a sub-block.
	ExampleSubBlock *SubBlock `protobuf:"bytes,1,opt,name=example_sub_block,json=exampleSubBlock,proto3" json:"exampleSubBlock,omitempty"`
	// contains filtered or unexported fields
}

Root is the root of the mock structure.

func (*Root) ApplySubBlock

func (r *Root) ApplySubBlock(id uint32, next block.SubBlock) error

ApplySubBlock applies a sub-block change with a field id.

func (*Root) BlockAliasIdentity added in v0.52.0

func (r *Root) BlockAliasIdentity() *block.AliasIdentityToken

BlockAliasIdentity returns the in-memory alias token for Root.

func (*Root) CloneMessageVT

func (m *Root) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*Root) CloneVT

func (m *Root) CloneVT() *Root

func (*Root) EqualMessageVT

func (this *Root) EqualMessageVT(thatMsg any) bool

func (*Root) EqualVT

func (this *Root) EqualVT(that *Root) bool

func (*Root) GetExampleSubBlock

func (x *Root) GetExampleSubBlock() *SubBlock

func (*Root) GetSubBlockCtor

func (r *Root) GetSubBlockCtor(id uint32) block.SubBlockCtor

GetSubBlockCtor returns a function which creates or returns the existing sub-block at reference id. Can return nil to indicate invalid reference id.

func (*Root) GetSubBlocks

func (r *Root) GetSubBlocks() map[uint32]block.SubBlock

GetSubBlocks returns all constructed sub-blocks by ID. May return nil, and values may also be nil.

func (*Root) IsNil

func (r *Root) IsNil() bool

IsNil returns if the object is nil.

func (*Root) MarshalBlock

func (r *Root) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*Root) MarshalJSON

func (x *Root) MarshalJSON() ([]byte, error)

MarshalJSON marshals the Root to JSON.

func (*Root) MarshalProtoJSON

func (x *Root) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the Root message to JSON.

func (*Root) MarshalProtoText

func (x *Root) MarshalProtoText() string

func (*Root) MarshalToSizedBufferVT

func (m *Root) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*Root) MarshalToVT

func (m *Root) MarshalToVT(dAtA []byte) (int, error)

func (*Root) MarshalVT

func (m *Root) MarshalVT() (dAtA []byte, err error)

func (*Root) ProtoMessage

func (*Root) ProtoMessage()

func (*Root) Reset

func (x *Root) Reset()

func (*Root) SizeVT

func (m *Root) SizeVT() (n int)

func (*Root) String

func (x *Root) String() string

func (*Root) UnmarshalBlock

func (r *Root) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*Root) UnmarshalJSON

func (x *Root) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the Root from JSON.

func (*Root) UnmarshalProtoJSON

func (x *Root) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the Root message from JSON.

func (*Root) UnmarshalVT

func (m *Root) UnmarshalVT(dAtA []byte) error

type SubBlock

type SubBlock struct {

	// ExamplePtr is an example reference.
	ExamplePtr *block.BlockRef `protobuf:"bytes,1,opt,name=example_ptr,json=examplePtr,proto3" json:"examplePtr,omitempty"`
	// contains filtered or unexported fields
}

SubBlock is a example sub-block of Root.

func (*SubBlock) ApplyBlockRef

func (r *SubBlock) ApplyBlockRef(id uint32, ptr *block.BlockRef) error

ApplyBlockRef applies a ref change with a field id.

func (*SubBlock) BlockAliasIdentity added in v0.52.0

func (r *SubBlock) BlockAliasIdentity() *block.AliasIdentityToken

BlockAliasIdentity returns the in-memory alias token for SubBlock.

func (*SubBlock) CloneMessageVT

func (m *SubBlock) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*SubBlock) CloneVT

func (m *SubBlock) CloneVT() *SubBlock

func (*SubBlock) EqualMessageVT

func (this *SubBlock) EqualMessageVT(thatMsg any) bool

func (*SubBlock) EqualVT

func (this *SubBlock) EqualVT(that *SubBlock) bool

func (*SubBlock) GetBlockRefCtor

func (r *SubBlock) GetBlockRefCtor(id uint32) block.Ctor

GetBlockRefCtor returns the constructor for the block at the ref id. Return nil to indicate invalid ref ID.

func (*SubBlock) GetBlockRefs

func (r *SubBlock) GetBlockRefs() (map[uint32]*block.BlockRef, error)

GetBlockRefs returns all filled block references.

func (*SubBlock) GetExamplePtr

func (x *SubBlock) GetExamplePtr() *block.BlockRef

func (*SubBlock) IsNil

func (r *SubBlock) IsNil() bool

IsNil returns if the object is nil.

func (*SubBlock) MarshalBlock

func (r *SubBlock) MarshalBlock() ([]byte, error)

MarshalBlock marshals the block to binary. This is the initial step of marshaling, before transformations.

func (*SubBlock) MarshalJSON

func (x *SubBlock) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SubBlock to JSON.

func (*SubBlock) MarshalProtoJSON

func (x *SubBlock) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the SubBlock message to JSON.

func (*SubBlock) MarshalProtoText

func (x *SubBlock) MarshalProtoText() string

func (*SubBlock) MarshalToSizedBufferVT

func (m *SubBlock) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SubBlock) MarshalToVT

func (m *SubBlock) MarshalToVT(dAtA []byte) (int, error)

func (*SubBlock) MarshalVT

func (m *SubBlock) MarshalVT() (dAtA []byte, err error)

func (*SubBlock) ProtoMessage

func (*SubBlock) ProtoMessage()

func (*SubBlock) Reset

func (x *SubBlock) Reset()

func (*SubBlock) SizeVT

func (m *SubBlock) SizeVT() (n int)

func (*SubBlock) String

func (x *SubBlock) String() string

func (*SubBlock) UnmarshalBlock

func (r *SubBlock) UnmarshalBlock(data []byte) error

UnmarshalBlock unmarshals the block to the object. This is the final step of decoding, after transformations.

func (*SubBlock) UnmarshalJSON

func (x *SubBlock) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the SubBlock from JSON.

func (*SubBlock) UnmarshalProtoJSON

func (x *SubBlock) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the SubBlock message from JSON.

func (*SubBlock) UnmarshalVT

func (m *SubBlock) UnmarshalVT(dAtA []byte) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL