Documentation ¶
Index ¶
- Variables
- func EachBlock(d Driver, f func(b *block.Block) bool) error
- func EachTransaction(d Driver, f func(t *block.Transaction) bool) error
- func RegisterDriver(name string, df DriverFactory)
- type Driver
- type DriverFactory
- type NonCachedDriver
- func (n *NonCachedDriver) GetBlockByContentHash(hash []byte) (*block.Block, error)
- func (n *NonCachedDriver) SeekAndStream(start time.Time, ctx context.Context) (<-chan *block.Block, <-chan error)
- func (n *NonCachedDriver) SeekAndStreamUntil(t time.Time, until time.Time, ctx context.Context) (<-chan *block.Block, <-chan error)
- func (n *NonCachedDriver) StreamBlocks(ctx context.Context) (<-chan *block.Block, <-chan error)
- func (n *NonCachedDriver) Write(b *block.Block) error
- func (n *NonCachedDriver) WriteMulti(b []*block.Block) error
Constants ¶
This section is empty.
Variables ¶
View Source
var (
ErrBlockNotFound = errors.New("Block not found.")
)
View Source
var (
ErrBuffToSmall = errors.New("Buffer too small for requested opperation.")
)
Functions ¶
func EachBlock ¶
EachBlock iterates through all blocks the driver has access to. if "f" returns false, it will stop iterating
func EachTransaction ¶
func EachTransaction(d Driver, f func(t *block.Transaction) bool) error
EachTransaction iterates through all transactions in all blocks
func RegisterDriver ¶
func RegisterDriver(name string, df DriverFactory)
Types ¶
type Driver ¶
type Driver interface { StreamBlocks(ctx context.Context) (<-chan *block.Block, <-chan error) Write(b *block.Block) error }
A Driver provides an interface to read and write blocks to/from persistance.
type DriverFactory ¶
type DriverFactory func(io.ReadWriteSeeker) Driver
type NonCachedDriver ¶
NonCachedDriver impliments the Driver interface with a single local file. As the name implies, this is a simple driver that does no caching.
func NewNonCachedDriver ¶
func NewNonCachedDriver(rws io.ReadWriteSeeker) *NonCachedDriver
func (*NonCachedDriver) GetBlockByContentHash ¶
func (n *NonCachedDriver) GetBlockByContentHash(hash []byte) (*block.Block, error)
func (*NonCachedDriver) SeekAndStream ¶
func (*NonCachedDriver) SeekAndStreamUntil ¶
func (*NonCachedDriver) StreamBlocks ¶
func (*NonCachedDriver) WriteMulti ¶
func (n *NonCachedDriver) WriteMulti(b []*block.Block) error
Click to show internal directories.
Click to hide internal directories.