Documentation ¶
Index ¶
- Variables
- func ByteToUInt32(b []byte) uint32
- func UInt32ToByte(v uint32) []byte
- 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 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
Constants ¶
This section is empty.
Variables ¶
var ( ReservedSubspaceKey = []byte("reserved") EncodingSubspaceKey = []byte("encoding") )
subspaces - only reason of not declaring these as consts because tests in different packages can overwrite this.
var (
InvalidId = uint32(0)
)
var (
SchemaSubspaceKey = []byte("schema")
)
SchemaSubspaceKey (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. - 0x01 is the revision of the schema.
Functions ¶
func ByteToUInt32 ¶
func UInt32ToByte ¶
Types ¶
type DictionaryEncoder ¶
type DictionaryEncoder struct {
// 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() *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 SchemaSubspace ¶
type SchemaSubspace struct{}
SchemaSubspace is used to manage schemas in schema subspace.
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.