Documentation
¶
Index ¶
- type BlockWithRoot
- type DB
- type DBID
- type DBMap
- type DBStats
- type DBs
- type FileDB
- func (db *FileDB) Export(root beacon.Root, w io.Writer) (exists bool, err error)
- func (db *FileDB) Get(root beacon.Root, dest *beacon.SignedBeaconBlock) (exists bool, err error)
- func (db *FileDB) Import(r io.Reader) (exists bool, err error)
- func (db *FileDB) List() (out []beacon.Root)
- func (db *FileDB) Path() string
- func (db *FileDB) Remove(root beacon.Root) (exists bool, err error)
- func (db *FileDB) Size(root beacon.Root) (size uint64, exists bool)
- func (db *FileDB) Stats() DBStats
- func (db *FileDB) Store(ctx context.Context, block *BlockWithRoot) (exists bool, err error)
- func (db *FileDB) Stream(root beacon.Root) (r io.ReadCloser, size uint64, exists bool, err error)
- type MemDB
- func (db *MemDB) Export(root beacon.Root, w io.Writer) (exists bool, err error)
- func (db *MemDB) Get(root beacon.Root, dest *beacon.SignedBeaconBlock) (exists bool, err error)
- func (db *MemDB) Import(r io.Reader) (exists bool, err error)
- func (db *MemDB) List() (out []beacon.Root)
- func (db *MemDB) Path() string
- func (db *MemDB) Remove(root beacon.Root) (exists bool, err error)
- func (db *MemDB) Size(root beacon.Root) (size uint64, exists bool)
- func (db *MemDB) Stats() DBStats
- func (db *MemDB) Store(ctx context.Context, block *BlockWithRoot) (exists bool, err error)
- func (db *MemDB) Stream(root beacon.Root) (r io.ReadCloser, size uint64, exists bool, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockWithRoot ¶
type BlockWithRoot struct {
// Root of the Block.Message
Root beacon.Root
// Block, with signature
Block *beacon.SignedBeaconBlock
}
func WithRoot ¶
func WithRoot(block *beacon.SignedBeaconBlock) *BlockWithRoot
type DB ¶
type DB interface {
// Store, only for trusted blocks, to persist a block in the DB.
// The block is stored in serialized form, so the original instance may be mutated after storing it.
// This is an efficient convenience method for using Import.
// Returns exists=true if the block exists (previously), false otherwise. If error, it may not be accurate.
// Returns slashable=true if exists=true, but the signatures are different. The existing block is kept.
Store(ctx context.Context, block *BlockWithRoot) (exists bool, err error)
// Import inserts a SignedBeaconBlock, read directly from the reader stream.
// Returns exists=true if the block exists (previously), false otherwise. If error, it may not be accurate.
// Returns slashable=true if exists=true, but the signatures are different. The existing block is kept.
Import(r io.Reader) (exists bool, err error)
// Get, an efficient convenience method for getting a block through Export. The block is safe to modify.
// The data at the pointer is mutated to the new block.
// Returns exists=true if the block exists, false otherwise. If error, it may not be accurate.
Get(root beacon.Root, dest *beacon.SignedBeaconBlock) (exists bool, err error)
// Size quickly checks the size of a block, without dealing with the full block.
// Returns exists=true if the block exists, false otherwise. If error, it may not be accurate.
Size(root beacon.Root) (size uint64, exists bool)
// Export outputs the requested SignedBeaconBlock to the writer in SSZ.
// Returns exists=true if the block exists, false otherwise. If error, it may not be accurate.
Export(root beacon.Root, w io.Writer) (exists bool, err error)
// Stream is used to stream the contents by getting a reader and total size to read
Stream(root beacon.Root) (r io.ReadCloser, size uint64, exists bool, err error)
// Remove removes a block from the DB. Removing a block that does not exist is safe.
// Returns exists=true if the block exists (previously), false otherwise. If error, it may not be accurate.
Remove(root beacon.Root) (exists bool, err error)
// Stats shows some database statistics such as latest write key and entry count.
Stats() DBStats
// List all known block roots
List() []beacon.Root
// Get Path
Path() string
}
type DBMap ¶ added in v0.2.1
type DBMap struct {
// contains filtered or unexported fields
}
type FileDB ¶ added in v0.2.1
type FileDB struct {
BasePath string
}
Click to show internal directories.
Click to hide internal directories.