Documentation
¶
Overview ¶
Package boltdb contains the boltdb implementations of the DAX interfaces.
Index ¶
- Constants
- Variables
- type Bucket
- type DB
- type DirectiveVersion
- type NodeService
- func (s *NodeService) CreateNode(ctx context.Context, addr dax.Address, node *dax.Node) error
- func (s *NodeService) DeleteNode(ctx context.Context, addr dax.Address) error
- func (s *NodeService) Nodes(ctx context.Context) ([]*dax.Node, error)
- func (s *NodeService) ReadNode(ctx context.Context, addr dax.Address) (*dax.Node, error)
- type Tx
Constants ¶
const (
ErrFmtBucketNotFound = "boltdb: bucket '%s' not found"
)
Variables ¶
var DirectiveBuckets []Bucket = []Bucket{
bucketDirective,
}
DirectiveBuckets defines the buckets used by this package. It can be called during setup to create the buckets ahead of time.
var NodeServiceBuckets []Bucket = []Bucket{
bucketNodes,
}
NodeServiceBuckets defines the buckets used by this package. It can be called during setup to create the buckets ahead of time.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB struct {
// Datasource name.
DSN string
// Returns the current time. Defaults to time.Now().
// Can be mocked for tests.
Now func() time.Time
// contains filtered or unexported fields
}
DB represents the database connection.
func NewSvcBolt ¶
NewSvcBolt gets, opens, and creates buckets for a boltDB for a particular named service (the data file will be named after the service).
func (*DB) BeginTx ¶
BeginTx starts a transaction and returns a wrapper Tx type. This type provides a reference to the database and a fixed timestamp at the start of the transaction. The timestamp allows us to mock time during tests as well.
func (*DB) InitializeBuckets ¶
InitializeBuckets creates the given buckets if they do not already exist.
func (*DB) RegisterBuckets ¶
RegisterBuckets queues up the buckets to be created when the database is first opened.
type DirectiveVersion ¶
type DirectiveVersion struct {
// contains filtered or unexported fields
}
func NewDirectiveVersion ¶
func NewDirectiveVersion(db *DB) *DirectiveVersion
type NodeService ¶
type NodeService struct {
// contains filtered or unexported fields
}
NodeService represents a service for managing nodes.
func NewNodeService ¶
func NewNodeService(db *DB, logger logger.Logger) *NodeService
NewNodeService returns a new instance of NodeService with default values.