tasknode

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: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func TestMetaStore_Database

func TestMetaStore_Database(t *testing.T)

func TestMetaStore_Datastore

func TestMetaStore_Datastore(t *testing.T)

func TestMetaStore_StorageNode

func TestMetaStore_StorageNode(t *testing.T)

Types

type Config

type Config struct {
	// Config for accessing metadata store
	MetaStoreType   datasource.StorageType `yaml:"metastore_type"`
	MetaStoreConfig map[string]interface{} `yaml:"metastore_config"`

	HTTP HTTPApiConfig `yaml:"http_api"`
}

Common configuration for all storage nodes

func (*Config) GetMetaStore

func (c *Config) GetMetaStore(metaFunc metadata.MetaFunc) (datasource.DataInterface, error)

type HTTPApi

type HTTPApi struct {
	// contains filtered or unexported fields
}

func NewHTTPApi

func NewHTTPApi(taskNode *TaskNode) *HTTPApi

func (*HTTPApi) Start

func (h *HTTPApi) Start(router *httprouter.Router)

Register any endpoints to the router

type HTTPApiConfig

type HTTPApiConfig struct {
	Addr string `yaml:"addr"`
}

HTTP API configuration

type MetadataStore

type MetadataStore struct {
	Store datasource.DataInterface
}

func (*MetadataStore) EnsureDoesntExistCollection

func (m *MetadataStore) EnsureDoesntExistCollection(ctx context.Context, dbname, collectionname string) error

TODO: to change

func (*MetadataStore) EnsureDoesntExistCollectionField

func (m *MetadataStore) EnsureDoesntExistCollectionField(ctx context.Context, dbname, collectionname, fieldname string) error

func (*MetadataStore) EnsureDoesntExistCollectionIndex

func (m *MetadataStore) EnsureDoesntExistCollectionIndex(ctx context.Context, dbname, collectionname, indexname string) error

func (*MetadataStore) EnsureDoesntExistCollectionKeyspace

func (m *MetadataStore) EnsureDoesntExistCollectionKeyspace(ctx context.Context, dbname, collectionname string) error

TODO: change once we support more keyspaces

func (*MetadataStore) EnsureDoesntExistCollectionKeyspacePartition

func (m *MetadataStore) EnsureDoesntExistCollectionKeyspacePartition(ctx context.Context, dbname, collectionname string, startId uint64) error

TODO: change once we support more partitions

func (*MetadataStore) EnsureDoesntExistDatabase

func (m *MetadataStore) EnsureDoesntExistDatabase(ctx context.Context, dbname string) error

func (*MetadataStore) EnsureDoesntExistDatabaseDatastore

func (m *MetadataStore) EnsureDoesntExistDatabaseDatastore(ctx context.Context, dbname, datastorename string) error

func (*MetadataStore) EnsureDoesntExistDatasourceInstance

func (m *MetadataStore) EnsureDoesntExistDatasourceInstance(ctx context.Context, id int64, datasourceinstance string) error

func (*MetadataStore) EnsureDoesntExistDatasourceInstanceShardInstance

func (m *MetadataStore) EnsureDoesntExistDatasourceInstanceShardInstance(ctx context.Context, id int64, datasourceinstance, datasourceinstanceshardinstance string) error

func (*MetadataStore) EnsureDoesntExistDatastore

func (m *MetadataStore) EnsureDoesntExistDatastore(ctx context.Context, datastorename string) error

func (*MetadataStore) EnsureDoesntExistDatastoreShard

func (m *MetadataStore) EnsureDoesntExistDatastoreShard(ctx context.Context, datastorename string, datastoreshardinstance int64) error

func (*MetadataStore) EnsureDoesntExistDatastoreShardReplica

func (m *MetadataStore) EnsureDoesntExistDatastoreShardReplica(ctx context.Context, datastorename string, datastoreshardinstance int64, datasourceinstanceid int64) error

func (*MetadataStore) EnsureDoesntExistDatastoreVShard

func (m *MetadataStore) EnsureDoesntExistDatastoreVShard(ctx context.Context, datastorename, vShardName string) error

func (*MetadataStore) EnsureDoesntExistDatastoreVShardInstance

func (m *MetadataStore) EnsureDoesntExistDatastoreVShardInstance(ctx context.Context, datastorename, vShardName string, datastorevshardinstance int64) error

func (*MetadataStore) EnsureDoesntExistStorageNode

func (m *MetadataStore) EnsureDoesntExistStorageNode(ctx context.Context, id int64) error

func (*MetadataStore) EnsureExistsCollection

func (m *MetadataStore) EnsureExistsCollection(ctx context.Context, db *metadata.Database, collection *metadata.Collection) error

Collection Changes

func (*MetadataStore) EnsureExistsCollectionField

func (m *MetadataStore) EnsureExistsCollectionField(ctx context.Context, db *metadata.Database, collection *metadata.Collection, field, parentField *storagenodemetadata.CollectionField) error

func (*MetadataStore) EnsureExistsCollectionIndex

func (m *MetadataStore) EnsureExistsCollectionIndex(ctx context.Context, db *metadata.Database, collection *metadata.Collection, index *storagenodemetadata.CollectionIndex) error

Index changes

func (*MetadataStore) EnsureExistsCollectionKeyspace

func (m *MetadataStore) EnsureExistsCollectionKeyspace(ctx context.Context, db *metadata.Database, collection *metadata.Collection, collectionKeyspace *metadata.CollectionKeyspace) error

func (*MetadataStore) EnsureExistsCollectionKeyspacePartition

func (m *MetadataStore) EnsureExistsCollectionKeyspacePartition(ctx context.Context, db *metadata.Database, collection *metadata.Collection, collectionKeyspace *metadata.CollectionKeyspace, collectionKeyspacePartition *metadata.CollectionKeyspacePartition) error

func (*MetadataStore) EnsureExistsDatabase

func (m *MetadataStore) EnsureExistsDatabase(ctx context.Context, db *metadata.Database) error

func (*MetadataStore) EnsureExistsDatabaseDatastore

func (m *MetadataStore) EnsureExistsDatabaseDatastore(ctx context.Context, db *metadata.Database, databaseDatastore *metadata.DatabaseDatastore) error

func (*MetadataStore) EnsureExistsDatasourceInstance

func (m *MetadataStore) EnsureExistsDatasourceInstance(ctx context.Context, storageNode *metadata.StorageNode, datasourceInstance *metadata.DatasourceInstance) error

func (*MetadataStore) EnsureExistsDatasourceInstanceShardInstance

func (m *MetadataStore) EnsureExistsDatasourceInstanceShardInstance(ctx context.Context, storageNode *metadata.StorageNode, datasourceInstance *metadata.DatasourceInstance, datasourceInstanceShardInstance *metadata.DatasourceInstanceShardInstance) error

TODO this one is a bit odd since it needs to check the existence of vshards etc. we'll pick this back up after database / schema manipulation is in

func (*MetadataStore) EnsureExistsDatastore

func (m *MetadataStore) EnsureExistsDatastore(ctx context.Context, datastore *metadata.Datastore) error

func (*MetadataStore) EnsureExistsDatastoreShard

func (m *MetadataStore) EnsureExistsDatastoreShard(ctx context.Context, datastore *metadata.Datastore, datastoreShard *metadata.DatastoreShard) error

func (*MetadataStore) EnsureExistsDatastoreShardReplica

func (m *MetadataStore) EnsureExistsDatastoreShardReplica(ctx context.Context, datastore *metadata.Datastore, datastoreShard *metadata.DatastoreShard, datastoreShardReplica *metadata.DatastoreShardReplica) error

func (*MetadataStore) EnsureExistsDatastoreVShard

func (m *MetadataStore) EnsureExistsDatastoreVShard(ctx context.Context, datastore *metadata.Datastore, vShard *metadata.DatastoreVShard) error

One for the top-level, and one for the instances as well! func (m *MetadataStore) EnsureExistsDatastoreVShard(datastore *metadata.Datastore, datastoreVShard *metadata.DatabaseVShard) error {

func (*MetadataStore) EnsureExistsDatastoreVShardInstance

func (m *MetadataStore) EnsureExistsDatastoreVShardInstance(ctx context.Context, datastore *metadata.Datastore, vShard *metadata.DatastoreVShard, vShardInstance *metadata.DatastoreVShardInstance) error

func (*MetadataStore) EnsureExistsStorageNode

func (m *MetadataStore) EnsureExistsStorageNode(ctx context.Context, storageNode *metadata.StorageNode) error

func (*MetadataStore) GetMeta

func (m *MetadataStore) GetMeta(ctx context.Context) (*metadata.Meta, error)

TODO: this should ideally load exactly *one* of any given record into a struct. This will require some work to do so, and we really should probably have something to codegen the record -> struct transition TODO: split into get/list for each item? TODO: have error?

func (*MetadataStore) GetSequence

func (m *MetadataStore) GetSequence(ctx context.Context, name string) (int64, error)

TODO: change to use an increment operator instead of the filter + (insert/update) thing Take (name, count) return (id, error)

type TaskNode

type TaskNode struct {
	Config    *Config
	MetaStore *MetadataStore
	// contains filtered or unexported fields
}

This node is responsible for routing requests to the appropriate storage node This is also responsible for maintaining schema, indexes, etc. from the metadata store

func NewTaskNode

func NewTaskNode(config *Config) (*TaskNode, error)

func (*TaskNode) EnsureDoesntExistDatabase

func (t *TaskNode) EnsureDoesntExistDatabase(ctx context.Context, dbname string) (err error)

func (*TaskNode) EnsureExistsDatabase

func (t *TaskNode) EnsureExistsDatabase(ctx context.Context, db *metadata.Database) (err error)

func (*TaskNode) FetchMeta

func (t *TaskNode) FetchMeta() error

This method will create a new `Databases` map and swap it in

func (*TaskNode) GetMeta

func (t *TaskNode) GetMeta() *metadata.Meta

func (*TaskNode) Start

func (t *TaskNode) Start() error

TODO: have a stop?

func (*TaskNode) Sync

func (t *TaskNode) Sync() error

TODO: remove? since we need to do this while holding the lock it seems useless

type TaskNodeMetrics

type TaskNodeMetrics struct {
	MetaLastSync     *metrics.ObserveArray
	MetaLastDuration *metrics.ObserveArray

	DatabaseQueryTime *metrics.ObserveArray
}

func NewTaskNodeMetrics

func NewTaskNodeMetrics(r metrics.Registry) TaskNodeMetrics

Jump to

Keyboard shortcuts

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