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
- type VersionStore
- func (s *VersionStore) AddFields(ctx context.Context, qtid dax.QualifiedTableID, fields ...dax.VersionedField) error
- func (s *VersionStore) AddPartitions(ctx context.Context, qtid dax.QualifiedTableID, ...) error
- func (s *VersionStore) AddShards(ctx context.Context, qtid dax.QualifiedTableID, shards ...dax.VersionedShard) error
- func (s *VersionStore) AddTable(ctx context.Context, qtid dax.QualifiedTableID) error
- func (s *VersionStore) Copy(ctx context.Context) (dax.VersionStore, error)
- func (s *VersionStore) FieldTables(ctx context.Context, qual dax.TableQualifier) (dax.TableIDs, error)
- func (s *VersionStore) FieldVersion(ctx context.Context, qtid dax.QualifiedTableID, field dax.FieldName) (int, bool, error)
- func (s *VersionStore) Fields(ctx context.Context, qtid dax.QualifiedTableID) (dax.VersionedFields, bool, error)
- func (s *VersionStore) PartitionTables(ctx context.Context, qual dax.TableQualifier) (dax.TableIDs, error)
- func (s *VersionStore) PartitionVersion(ctx context.Context, qtid dax.QualifiedTableID, partitionNum dax.PartitionNum) (int, bool, error)
- func (s *VersionStore) Partitions(ctx context.Context, qtid dax.QualifiedTableID) (dax.VersionedPartitions, bool, error)
- func (s *VersionStore) RemoveTable(ctx context.Context, qtid dax.QualifiedTableID) (dax.VersionedShards, dax.VersionedPartitions, error)
- func (s *VersionStore) ShardTables(ctx context.Context, qual dax.TableQualifier) (dax.TableIDs, error)
- func (s *VersionStore) ShardVersion(ctx context.Context, qtid dax.QualifiedTableID, shardNum dax.ShardNum) (int, bool, error)
- func (s *VersionStore) Shards(ctx context.Context, qtid dax.QualifiedTableID) (dax.VersionedShards, bool, error)
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.
var VersionStoreBuckets []Bucket = []Bucket{
bucketTables,
bucketShards,
bucketTableKeys,
bucketFieldKeys,
}
VersionStoreBuckets 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.
func (*NodeService) CreateNode ¶
func (*NodeService) DeleteNode ¶
type VersionStore ¶
type VersionStore struct {
// contains filtered or unexported fields
}
VersionStore manages all version info for shard, table keys, and field keys.
func NewVersionStore ¶
func NewVersionStore(db *DB, logger logger.Logger) *VersionStore
NewVersionStore returns a new instance of VersionStore with default values.
func (*VersionStore) AddFields ¶
func (s *VersionStore) AddFields(ctx context.Context, qtid dax.QualifiedTableID, fields ...dax.VersionedField) error
AddFields adds new fields to be managed by VersionStore. It returns the number of fields added or an error.
func (*VersionStore) AddPartitions ¶
func (s *VersionStore) AddPartitions(ctx context.Context, qtid dax.QualifiedTableID, partitions ...dax.VersionedPartition) error
AddPartitions adds new partitions to be managed by VersionStore. It returns the number of partitions added or an error.
func (*VersionStore) AddShards ¶
func (s *VersionStore) AddShards(ctx context.Context, qtid dax.QualifiedTableID, shards ...dax.VersionedShard) error
func (*VersionStore) AddTable ¶
func (s *VersionStore) AddTable(ctx context.Context, qtid dax.QualifiedTableID) error
func (*VersionStore) Copy ¶
func (s *VersionStore) Copy(ctx context.Context) (dax.VersionStore, error)
Copy returns an in-memory copy of VersionStore.
func (*VersionStore) FieldTables ¶
func (s *VersionStore) FieldTables(ctx context.Context, qual dax.TableQualifier) (dax.TableIDs, error)
func (*VersionStore) FieldVersion ¶
func (s *VersionStore) FieldVersion(ctx context.Context, qtid dax.QualifiedTableID, field dax.FieldName) (int, bool, error)
func (*VersionStore) Fields ¶
func (s *VersionStore) Fields(ctx context.Context, qtid dax.QualifiedTableID) (dax.VersionedFields, bool, error)
func (*VersionStore) PartitionTables ¶
func (s *VersionStore) PartitionTables(ctx context.Context, qual dax.TableQualifier) (dax.TableIDs, error)
func (*VersionStore) PartitionVersion ¶
func (s *VersionStore) PartitionVersion(ctx context.Context, qtid dax.QualifiedTableID, partitionNum dax.PartitionNum) (int, bool, error)
func (*VersionStore) Partitions ¶
func (s *VersionStore) Partitions(ctx context.Context, qtid dax.QualifiedTableID) (dax.VersionedPartitions, bool, error)
func (*VersionStore) RemoveTable ¶
func (s *VersionStore) RemoveTable(ctx context.Context, qtid dax.QualifiedTableID) (dax.VersionedShards, dax.VersionedPartitions, error)
func (*VersionStore) ShardTables ¶
func (s *VersionStore) ShardTables(ctx context.Context, qual dax.TableQualifier) (dax.TableIDs, error)
func (*VersionStore) ShardVersion ¶
func (s *VersionStore) ShardVersion(ctx context.Context, qtid dax.QualifiedTableID, shardNum dax.ShardNum) (int, bool, error)
ShardVersion return the current version for the given table/shardNum. If a version is not being tracked, it returns a bool value of false.
func (*VersionStore) Shards ¶
func (s *VersionStore) Shards(ctx context.Context, qtid dax.QualifiedTableID) (dax.VersionedShards, bool, error)