Documentation ¶
Index ¶
- Variables
- func ByteToUInt32(b []byte) uint32
- func UInt32ToByte(v uint32) []byte
- type DefaultMDNameRegistry
- type DictionaryEncoder
- func (k *DictionaryEncoder) EncodeCollectionAsDropped(ctx context.Context, tx transaction.Tx, collection string, namespaceId uint32, ...) error
- func (k *DictionaryEncoder) EncodeCollectionName(ctx context.Context, tx transaction.Tx, collection string, namespaceId uint32, ...) (uint32, error)
- func (k *DictionaryEncoder) EncodeDatabaseAsDropped(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32, ...) error
- func (k *DictionaryEncoder) EncodeDatabaseName(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32) (uint32, error)
- func (k *DictionaryEncoder) EncodeIndexAsDropped(ctx context.Context, tx transaction.Tx, indexName string, namespaceId uint32, ...) error
- func (k *DictionaryEncoder) EncodeIndexName(ctx context.Context, tx transaction.Tx, indexName string, namespaceId uint32, ...) (uint32, error)
- func (k *DictionaryEncoder) GetCollectionId(ctx context.Context, tx transaction.Tx, collName string, namespaceId uint32, ...) (uint32, error)
- func (k *DictionaryEncoder) GetCollections(ctx context.Context, tx transaction.Tx, namespaceId uint32, databaseId uint32) (map[string]uint32, error)
- func (k *DictionaryEncoder) GetDatabaseId(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32) (uint32, error)
- func (k *DictionaryEncoder) GetDatabases(ctx context.Context, tx transaction.Tx, namespaceId uint32) (map[string]uint32, error)
- func (k *DictionaryEncoder) GetIndexId(ctx context.Context, tx transaction.Tx, indexName string, namespaceId uint32, ...) (uint32, error)
- func (k *DictionaryEncoder) GetIndexes(ctx context.Context, tx transaction.Tx, namespaceId uint32, databaseId uint32, ...) (map[string]uint32, error)
- func (k *DictionaryEncoder) GetNamespaces(ctx context.Context, tx transaction.Tx) (map[string]uint32, error)
- func (k *DictionaryEncoder) ReserveNamespace(ctx context.Context, tx transaction.Tx, namespace string, id uint32) error
- type MDNameRegistry
- type SchemaSubspace
- func (s *SchemaSubspace) Delete(ctx context.Context, tx transaction.Tx, namespaceId uint32, dbId uint32, ...) error
- func (s *SchemaSubspace) Get(ctx context.Context, tx transaction.Tx, namespaceId uint32, dbId uint32, ...) ([][]byte, []int, error)
- func (s *SchemaSubspace) GetLatest(ctx context.Context, tx transaction.Tx, namespaceId uint32, dbId uint32, ...) ([]byte, int, error)
- func (s *SchemaSubspace) Put(ctx context.Context, tx transaction.Tx, namespaceId uint32, dbId uint32, ...) error
- type TestMDNameRegistry
Constants ¶
This section is empty.
Variables ¶
var (
InvalidId = uint32(0)
)
Functions ¶
func ByteToUInt32 ¶
func UInt32ToByte ¶
Types ¶
type DefaultMDNameRegistry ¶
type DefaultMDNameRegistry struct{}
DefaultMDNameRegistry provides the names of the subspaces used by the metadata package for managing dictionary encoded values, counters and schemas.
func (*DefaultMDNameRegistry) EncodingSubspaceName ¶
func (d *DefaultMDNameRegistry) EncodingSubspaceName() []byte
func (*DefaultMDNameRegistry) ReservedSubspaceName ¶
func (d *DefaultMDNameRegistry) ReservedSubspaceName() []byte
func (*DefaultMDNameRegistry) SchemaSubspaceName ¶
func (d *DefaultMDNameRegistry) SchemaSubspaceName() []byte
type DictionaryEncoder ¶
type DictionaryEncoder struct { MDNameRegistry // contains filtered or unexported fields }
DictionaryEncoder is used to replace variable length strings to their corresponding codes to encode it. Compression is achieved by replacing long strings with a simple 4byte representation.
func NewDictionaryEncoder ¶
func NewDictionaryEncoder(mdNameRegistry MDNameRegistry) *DictionaryEncoder
func (*DictionaryEncoder) EncodeCollectionAsDropped ¶
func (k *DictionaryEncoder) EncodeCollectionAsDropped(ctx context.Context, tx transaction.Tx, collection string, namespaceId uint32, dbId uint32, existingId uint32) error
func (*DictionaryEncoder) EncodeCollectionName ¶
func (k *DictionaryEncoder) EncodeCollectionName(ctx context.Context, tx transaction.Tx, collection string, namespaceId uint32, dbId uint32) (uint32, error)
func (*DictionaryEncoder) EncodeDatabaseAsDropped ¶
func (k *DictionaryEncoder) EncodeDatabaseAsDropped(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32, existingId uint32) error
EncodeDatabaseAsDropped will remove the "created" entry from the encoding subspace and will add a "dropped" entry with the same value.
func (*DictionaryEncoder) EncodeDatabaseName ¶
func (k *DictionaryEncoder) EncodeDatabaseName(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32) (uint32, error)
func (*DictionaryEncoder) EncodeIndexAsDropped ¶
func (*DictionaryEncoder) EncodeIndexName ¶
func (*DictionaryEncoder) GetCollectionId ¶
func (k *DictionaryEncoder) GetCollectionId(ctx context.Context, tx transaction.Tx, collName string, namespaceId uint32, dbId uint32) (uint32, error)
func (*DictionaryEncoder) GetCollections ¶
func (k *DictionaryEncoder) GetCollections(ctx context.Context, tx transaction.Tx, namespaceId uint32, databaseId uint32) (map[string]uint32, error)
func (*DictionaryEncoder) GetDatabaseId ¶
func (k *DictionaryEncoder) GetDatabaseId(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32) (uint32, error)
func (*DictionaryEncoder) GetDatabases ¶
func (k *DictionaryEncoder) GetDatabases(ctx context.Context, tx transaction.Tx, namespaceId uint32) (map[string]uint32, error)
func (*DictionaryEncoder) GetIndexId ¶
func (*DictionaryEncoder) GetIndexes ¶
func (*DictionaryEncoder) GetNamespaces ¶
func (k *DictionaryEncoder) GetNamespaces(ctx context.Context, tx transaction.Tx) (map[string]uint32, error)
func (*DictionaryEncoder) ReserveNamespace ¶
func (k *DictionaryEncoder) ReserveNamespace(ctx context.Context, tx transaction.Tx, namespace string, id uint32) error
ReserveNamespace is the first step in the encoding and the mapping is passed the caller. As this is the first encoded integer the caller needs to make sure a unique value is assigned to this namespace.
type MDNameRegistry ¶
type MDNameRegistry interface { // ReservedSubspaceName is the name of the table(subspace) where all the counters are stored. ReservedSubspaceName() []byte // EncodingSubspaceName is the name of the table(subspace) which is used by the dictionary encoder to store all the // dictionary encoded values. EncodingSubspaceName() []byte // SchemaSubspaceName (the schema subspace) will be storing the actual schema of the user for a collection. The schema subspace will // look like below // ["schema", 0x01, x, 0x01, 0x03, "created", 0x01] => {"title": "t1", properties: {"a": int}, primary_key: ["a"]} // // where, // - schema is the keyword for this table. // - 0x01 is the schema subspace version // - x is the value assigned for the namespace // - 0x01 is the value for the database. // - 0x03 is the value for the collection. // - "created" is keyword. // SchemaSubspaceName() []byte }
MDNameRegistry provides the names of the internal tables(subspaces) maintained by the metadata package. The interface helps in creating test tables for these structures.
type SchemaSubspace ¶
type SchemaSubspace struct {
MDNameRegistry
}
SchemaSubspace is used to manage schemas in schema subspace.
func NewSchemaStore ¶
func NewSchemaStore(mdNameRegistry MDNameRegistry) *SchemaSubspace
func (*SchemaSubspace) Delete ¶
func (s *SchemaSubspace) Delete(ctx context.Context, tx transaction.Tx, namespaceId uint32, dbId uint32, collId uint32) error
Delete is to remove schema for a given namespace, database and collection.
func (*SchemaSubspace) Get ¶
func (s *SchemaSubspace) Get(ctx context.Context, tx transaction.Tx, namespaceId uint32, dbId uint32, collId uint32) ([][]byte, []int, error)
Get returns all the version stored for a collection inside a given namespace and database.
type TestMDNameRegistry ¶
TestMDNameRegistry is used by tests to inject table names that can be used by tests
func (*TestMDNameRegistry) EncodingSubspaceName ¶
func (d *TestMDNameRegistry) EncodingSubspaceName() []byte
func (*TestMDNameRegistry) ReservedSubspaceName ¶
func (d *TestMDNameRegistry) ReservedSubspaceName() []byte
func (*TestMDNameRegistry) SchemaSubspaceName ¶
func (d *TestMDNameRegistry) SchemaSubspaceName() []byte