Documentation ¶
Index ¶
- Constants
- func RandBool(p float64) bool
- func XX3HashBlockId(id BlockId, seed uint64) uint64
- type Block
- type BlockId
- func (id BlockId) MarshalBinary() ([]byte, error)
- func (id BlockId) MarshalCBOR() ([]byte, error)
- func (id BlockId) MarshalJSON() ([]byte, error)
- func (id *BlockId) Read(reader core.ByteAndBlockReader) (int, error)
- func (id BlockId) String() string
- func (id *BlockId) UnmarshalBinary(bytes []byte) error
- func (id *BlockId) UnmarshalCBOR(bytes []byte) error
- func (id *BlockId) UnmarshalJSON(bytes []byte) error
- type Config
- type MockIdJsonFormat
- type Store
- func (bs *Store) Add(_ context.Context, rawBlock core.RawBlock[BlockId]) (core.Block[BlockId], error)
- func (bs *Store) AddAll(ctx context.Context, store core.BlockStore[BlockId]) error
- func (bs *Store) AddMany(_ context.Context, rawBlocks []core.RawBlock[BlockId]) ([]core.Block[BlockId], error)
- func (bs *Store) All(_ context.Context) (<-chan BlockId, error)
- func (bs *Store) Dump(id BlockId, log *zap.SugaredLogger, spacer string) (core.Block[BlockId], error)
- func (bs *Store) Get(_ context.Context, id BlockId) (core.Block[BlockId], error)
- func (bs *Store) Has(_ context.Context, id BlockId) (bool, error)
- func (bs *Store) HasAll(root BlockId) bool
- func (bs *Store) RandomBlock() (core.Block[BlockId], error)
- func (bs *Store) Reconfigure(config Config)
- func (bs *Store) Remove(id BlockId)
Constants ¶
View Source
const BLOCK_ID_SIZE = 32
Variables ¶
This section is empty.
Functions ¶
func XX3HashBlockId ¶
Types ¶
type Block ¶
type Block struct {
// contains filtered or unexported fields
}
Block
func RandMockBlock ¶
func RandMockBlock() *Block
Generate a random block up to 10k bytes in length Does not allocate memory for the byte array
type BlockId ¶
type BlockId [BLOCK_ID_SIZE]byte
Defines a simple block 256-bit BlockId
func AddRandomForest ¶
func AddRandomTree ¶
func (BlockId) MarshalBinary ¶
Gets the data for this block as a byte array
func (BlockId) MarshalCBOR ¶
func (BlockId) MarshalJSON ¶
func (*BlockId) UnmarshalBinary ¶
func (*BlockId) UnmarshalCBOR ¶
func (*BlockId) UnmarshalJSON ¶
type Config ¶
type Config struct { WriteStorageLatency time.Duration WriteStorageBandwith time.Duration // time to write one byte ReadStorageLatency time.Duration ReadStorageBandwith time.Duration // time to write one byte }
func DefaultConfig ¶
func DefaultConfig() Config
type MockIdJsonFormat ¶
type MockIdJsonFormat struct {
Id []byte `json:"id"`
}
Click to show internal directories.
Click to hide internal directories.