datasource

package
v0.0.0-...-49e5460 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DirectMetaFunc

func DirectMetaFunc(schema SchemaInterface) metadata.MetaFunc

Types

type DataInterface

Storage data interface for handling all the queries etc

type SchemaInterface

type SchemaInterface interface {
	ListDatabase(ctx context.Context) []*metadata.Database
	GetDatabase(ctx context.Context, dname string) *metadata.Database
	AddDatabase(ctx context.Context, db *metadata.Database) error
	RemoveDatabase(ctx context.Context, dbname string) error

	ListShardInstance(ctx context.Context, dbname string) []*metadata.ShardInstance
	GetShardInstance(ctx context.Context, dbname, shardinstance string) *metadata.ShardInstance
	AddShardInstance(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance) error
	RemoveShardInstance(ctx context.Context, dbname, shardInstance string) error

	// TODO: everything below needs to include the shardInstance dimension
	ListCollection(ctx context.Context, dbname, shardinstance string) []*metadata.Collection
	GetCollection(ctx context.Context, dbname, shardinstance, collectionname string) *metadata.Collection
	AddCollection(ctx context.Context, db *metadata.Database, shardinstance *metadata.ShardInstance, collection *metadata.Collection) error
	RemoveCollection(ctx context.Context, dbname, shardinstance, collectionname string) error

	ListCollectionField(ctx context.Context, dbname, shardinstance, collectionname string) []*metadata.CollectionField
	GetCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldname string) *metadata.CollectionField
	AddCollectionField(ctx context.Context, db *metadata.Database, shardinstance *metadata.ShardInstance, collection *metadata.Collection, field *metadata.CollectionField) error
	// TODO: implement? So we can do changes like uniqueness etc.
	// for now we'll just remove and add (if the name matches) -- which is not
	// what we want for real-world usage
	//UpdateCollectionField(db *metadata.Database, shardinstance *metadata.ShardInstance, collection *metadata.Collection, field *metadata.CollectionField) error
	RemoveCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldname string) error

	ListCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname string) []*metadata.CollectionIndex
	GetCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) *metadata.CollectionIndex
	AddCollectionIndex(ctx context.Context, db *metadata.Database, shardinstance *metadata.ShardInstance, collection *metadata.Collection, index *metadata.CollectionIndex) error
	// TODO
	//UpdateCollectionIndex(db *metadata.Database, shardinstance *metadata.ShardInstance, collection *metadata.Collection, index *metadata.CollectionIndex) error
	RemoveCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) error
}

TODO: add flags for "remove" etc. so we can make schema changes without removing anything (meaning the underlying datasource_instance_shard_instance would be a superset of the schema passed in-- useful for schema migrations) Schema interface to the underlying datastore

type StorageType

type StorageType string
const (
	Postgres StorageType = "postgres"
)

func (StorageType) Get

func (s StorageType) Get() DataInterface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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