storage

package
v0.4.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(conf config.Database, l logger.Interface) (err error)

Migrate - migrate the database

Types

type NoopRelationshipReader added in v0.4.4

type NoopRelationshipReader struct{}

func (*NoopRelationshipReader) HeadSnapshot added in v0.4.4

func (*NoopRelationshipReader) QueryRelationships added in v0.4.4

func (*NoopRelationshipReader) ReadRelationships added in v0.4.4

type NoopRelationshipWriter added in v0.4.4

type NoopRelationshipWriter struct{}

func (*NoopRelationshipWriter) DeleteRelationships added in v0.4.4

func (*NoopRelationshipWriter) WriteRelationships added in v0.4.4

type NoopSchemaReader added in v0.4.4

type NoopSchemaReader struct{}

func (*NoopSchemaReader) HeadVersion added in v0.4.4

func (n *NoopSchemaReader) HeadVersion(_ context.Context, _ string) (string, error)

func (*NoopSchemaReader) ReadSchema added in v0.4.4

func (*NoopSchemaReader) ReadSchemaDefinition added in v0.4.4

func (n *NoopSchemaReader) ReadSchemaDefinition(_ context.Context, _ string, _, _ string) (*base.EntityDefinition, string, error)

type NoopSchemaWriter added in v0.4.4

type NoopSchemaWriter struct{}

func (*NoopSchemaWriter) WriteSchema added in v0.4.4

func (n *NoopSchemaWriter) WriteSchema(_ context.Context, _ []SchemaDefinition) error

type NoopTenantReader added in v0.4.4

type NoopTenantReader struct{}

func (*NoopTenantReader) ListTenants added in v0.4.4

type NoopTenantWriter added in v0.4.4

type NoopTenantWriter struct{}

func (*NoopTenantWriter) CreateTenant added in v0.4.4

func (n *NoopTenantWriter) CreateTenant(_ context.Context, _, _ string) (*base.Tenant, error)

func (*NoopTenantWriter) DeleteTenant added in v0.4.4

func (n *NoopTenantWriter) DeleteTenant(_ context.Context, _ string) (*base.Tenant, error)

type NoopWatcher added in v0.4.4

type NoopWatcher struct{}

func (*NoopWatcher) Watch added in v0.4.4

func (n *NoopWatcher) Watch(_ context.Context, _ string, _ string) (<-chan *base.TupleChanges, <-chan error)

type RelationTuple

type RelationTuple struct {
	ID              uint64
	TenantID        string
	EntityType      string
	EntityID        string
	Relation        string
	SubjectType     string
	SubjectID       string
	SubjectRelation string
}

RelationTuple - Structure for Relational Tuple

func (RelationTuple) ToTuple

func (r RelationTuple) ToTuple() *base.Tuple

ToTuple - Convert database relation tuple to base relation tuple

type RelationshipReader

type RelationshipReader interface {
	// QueryRelationships reads relation tuples from the storage.
	QueryRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter, snap string) (iterator *database.TupleIterator, err error)
	// ReadRelationships reads relation tuples from the storage with different options.
	ReadRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter, snap string, pagination database.Pagination) (collection *database.TupleCollection, ct database.EncodedContinuousToken, err error)
	// HeadSnapshot reads the latest version of the snapshot from the storage.
	HeadSnapshot(ctx context.Context, tenantID string) (token.SnapToken, error)
}

RelationshipReader - Reads relation tuples from the storage.

func NewNoopRelationshipReader added in v0.4.4

func NewNoopRelationshipReader() RelationshipReader

type RelationshipWriter

type RelationshipWriter interface {
	// WriteRelationships writes relation tuples to the storage.
	WriteRelationships(ctx context.Context, tenantID string, collection *database.TupleCollection) (token token.EncodedSnapToken, err error)
	// DeleteRelationships deletes relation tuples from the storage.
	DeleteRelationships(ctx context.Context, tenantID string, filter *base.TupleFilter) (token token.EncodedSnapToken, err error)
}

RelationshipWriter - Writes relation tuples to the storage.

func NewNoopRelationshipWriter added in v0.4.4

func NewNoopRelationshipWriter() RelationshipWriter

type SchemaDefinition

type SchemaDefinition struct {
	TenantID             string
	EntityType           string
	SerializedDefinition []byte
	Version              string
}

SchemaDefinition - Structure for Schema Definition

func (SchemaDefinition) Serialized

func (e SchemaDefinition) Serialized() string

Serialized - get schema serialized definition

type SchemaReader

type SchemaReader interface {
	// ReadSchema reads entity config from the storage.
	ReadSchema(ctx context.Context, tenantID string, version string) (schema *base.SchemaDefinition, err error)
	// ReadSchemaDefinition reads entity config from the storage.
	ReadSchemaDefinition(ctx context.Context, tenantID string, entityType, version string) (definition *base.EntityDefinition, v string, err error)
	// HeadVersion reads the latest version of the schema from the storage.
	HeadVersion(ctx context.Context, tenantID string) (version string, err error)
}

SchemaReader - Reads schema definitions from the storage.

func NewNoopSchemaReader added in v0.4.4

func NewNoopSchemaReader() SchemaReader

type SchemaWriter

type SchemaWriter interface {
	// WriteSchema writes schema to the storage.
	WriteSchema(ctx context.Context, definitions []SchemaDefinition) (err error)
}

SchemaWriter - Writes schema definitions to the storage.

func NewNoopSchemaWriter added in v0.4.4

func NewNoopSchemaWriter() SchemaWriter

type Tenant

type Tenant struct {
	ID        string
	Name      string
	CreatedAt time.Time
}

Tenant - Structure for tenant

func (Tenant) ToTenant

func (r Tenant) ToTenant() *base.Tenant

ToTenant - Convert database tenant to base tenant

type TenantReader

type TenantReader interface {
	// ListTenants reads tenants from the storage.
	ListTenants(ctx context.Context, pagination database.Pagination) (tenants []*base.Tenant, ct database.EncodedContinuousToken, err error)
}

TenantReader - Reads tenants from the storage.

func NewNoopTenantReader added in v0.4.4

func NewNoopTenantReader() TenantReader

type TenantWriter

type TenantWriter interface {
	// CreateTenant writes tenant to the storage.
	CreateTenant(ctx context.Context, id, name string) (tenant *base.Tenant, err error)
	// DeleteTenant deletes tenant from the storage.
	DeleteTenant(ctx context.Context, tenantID string) (tenant *base.Tenant, err error)
}

TenantWriter - Writes tenants to the storage.

func NewNoopTenantWriter added in v0.4.4

func NewNoopTenantWriter() TenantWriter

type Watcher added in v0.4.4

type Watcher interface {
	// Watch watches relation tuple changes from the storage.
	Watch(ctx context.Context, tenantID string, snap string) (<-chan *base.TupleChanges, <-chan error)
}

Watcher - Watches relation tuple changes from the storage.

func NewNoopWatcher added in v0.4.4

func NewNoopWatcher() Watcher

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL