Documentation ¶
Index ¶
- Variables
- func ByteToUInt16(b []byte) uint16
- func ByteToUInt32(b []byte) uint32
- func UInt16ToByte(v uint16) []byte
- func UInt32ToByte(v uint32) []byte
- type DefaultMDNameRegistry
- type MDNameRegistry
- type MetadataDictionary
- func (k *MetadataDictionary) CreateCollection(ctx context.Context, tx transaction.Tx, collection string, namespaceId uint32, ...) (uint32, error)
- func (k *MetadataDictionary) CreateDatabase(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32) (uint32, error)
- func (k *MetadataDictionary) CreateIndex(ctx context.Context, tx transaction.Tx, indexName string, namespaceId uint32, ...) (uint32, error)
- func (k *MetadataDictionary) DropCollection(ctx context.Context, tx transaction.Tx, collection string, namespaceId uint32, ...) error
- func (k *MetadataDictionary) DropDatabase(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32, ...) error
- func (k *MetadataDictionary) DropIndex(ctx context.Context, tx transaction.Tx, indexName string, namespaceId uint32, ...) error
- func (k *MetadataDictionary) GetCollectionId(ctx context.Context, tx transaction.Tx, collName string, namespaceId uint32, ...) (uint32, error)
- func (k *MetadataDictionary) GetCollections(ctx context.Context, tx transaction.Tx, namespaceId uint32, databaseId uint32) (map[string]uint32, error)
- func (k *MetadataDictionary) GetDatabaseId(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32) (uint32, error)
- func (k *MetadataDictionary) GetDatabases(ctx context.Context, tx transaction.Tx, namespaceId uint32) (map[string]uint32, error)
- func (k *MetadataDictionary) GetIndexId(ctx context.Context, tx transaction.Tx, indexName string, namespaceId uint32, ...) (uint32, error)
- func (k *MetadataDictionary) GetIndexes(ctx context.Context, tx transaction.Tx, namespaceId uint32, databaseId uint32, ...) (map[string]uint32, error)
- func (k *MetadataDictionary) GetNamespaces(ctx context.Context, tx transaction.Tx) (map[string]uint32, error)
- func (k *MetadataDictionary) ReserveNamespace(ctx context.Context, tx transaction.Tx, namespace string, id uint32) error
- 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 ByteToUInt16 ¶
func ByteToUInt32 ¶
func UInt16ToByte ¶
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 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 MetadataDictionary ¶
type MetadataDictionary struct { MDNameRegistry // contains filtered or unexported fields }
MetadataDictionary is used to replace variable length strings to their corresponding codes to allocateAndSave it. Compression is achieved by replacing long strings with a simple 4byte representation.
func NewMetadataDictionary ¶
func NewMetadataDictionary(mdNameRegistry MDNameRegistry) *MetadataDictionary
func (*MetadataDictionary) CreateCollection ¶
func (k *MetadataDictionary) CreateCollection(ctx context.Context, tx transaction.Tx, collection string, namespaceId uint32, dbId uint32) (uint32, error)
func (*MetadataDictionary) CreateDatabase ¶
func (k *MetadataDictionary) CreateDatabase(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32) (uint32, error)
func (*MetadataDictionary) CreateIndex ¶
func (*MetadataDictionary) DropCollection ¶
func (k *MetadataDictionary) DropCollection(ctx context.Context, tx transaction.Tx, collection string, namespaceId uint32, dbId uint32, existingId uint32) error
func (*MetadataDictionary) DropDatabase ¶
func (k *MetadataDictionary) DropDatabase(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32, existingId uint32) error
DropDatabase will remove the "created" entry from the encoding subspace and will add a "dropped" entry with the same value.
func (*MetadataDictionary) GetCollectionId ¶
func (k *MetadataDictionary) GetCollectionId(ctx context.Context, tx transaction.Tx, collName string, namespaceId uint32, dbId uint32) (uint32, error)
func (*MetadataDictionary) GetCollections ¶
func (k *MetadataDictionary) GetCollections(ctx context.Context, tx transaction.Tx, namespaceId uint32, databaseId uint32) (map[string]uint32, error)
func (*MetadataDictionary) GetDatabaseId ¶
func (k *MetadataDictionary) GetDatabaseId(ctx context.Context, tx transaction.Tx, dbName string, namespaceId uint32) (uint32, error)
func (*MetadataDictionary) GetDatabases ¶
func (k *MetadataDictionary) GetDatabases(ctx context.Context, tx transaction.Tx, namespaceId uint32) (map[string]uint32, error)
func (*MetadataDictionary) GetIndexId ¶
func (*MetadataDictionary) GetIndexes ¶
func (*MetadataDictionary) GetNamespaces ¶
func (k *MetadataDictionary) GetNamespaces(ctx context.Context, tx transaction.Tx) (map[string]uint32, error)
func (*MetadataDictionary) ReserveNamespace ¶
func (k *MetadataDictionary) 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 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