Documentation ¶
Index ¶
- func GetSchema() string
- func TestMetaStore_Database(t *testing.T)
- func TestMetaStore_ShardInstance(t *testing.T)
- type Config
- type DatasourceInstance
- func NewDatasourceInstance(config *DatasourceInstanceConfig, metaStore StorageMetadataStore) (*DatasourceInstance, error)
- func NewDatasourceInstanceDefault(config *DatasourceInstanceConfig) (*DatasourceInstance, error)
- func NewLocalDatasourceInstance(config *DatasourceInstanceConfig, meta *metadata.Meta) (*DatasourceInstance, error)
- func (s *DatasourceInstance) EnsureDoesntExistCollection(ctx context.Context, dbname, shardinstance, collectionname string) error
- func (s *DatasourceInstance) EnsureDoesntExistCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldname string) error
- func (s *DatasourceInstance) EnsureDoesntExistCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) error
- func (s *DatasourceInstance) EnsureDoesntExistDatabase(ctx context.Context, dbname string) error
- func (s *DatasourceInstance) EnsureDoesntExistShardInstance(ctx context.Context, dbname string, shardinstance string) error
- func (s *DatasourceInstance) EnsureExistsCollection(ctx context.Context, db *metadata.Database, ...) error
- func (s *DatasourceInstance) EnsureExistsCollectionField(ctx context.Context, db *metadata.Database, ...) error
- func (s *DatasourceInstance) EnsureExistsCollectionIndex(ctx context.Context, db *metadata.Database, ...) error
- func (s *DatasourceInstance) EnsureExistsDatabase(ctx context.Context, db *metadata.Database) error
- func (s *DatasourceInstance) EnsureExistsShardInstance(ctx context.Context, db *metadata.Database, ...) error
- func (s *DatasourceInstance) GetActiveMeta() *metadata.Meta
- func (s *DatasourceInstance) GetMeta() *metadata.Meta
- func (s *DatasourceInstance) HandleQuery(ctx context.Context, q *query.Query) *query.Result
- func (s *DatasourceInstance) HandleStreamQuery(ctx context.Context, q *query.Query) *query.ResultStream
- func (s *DatasourceInstance) RefreshMeta() error
- func (s *DatasourceInstance) Sync() error
- type DatasourceInstanceConfig
- type DatasourceInstanceMetrics
- type DatasourceInstanceTransport
- type DefaultMetadataStore
- func (m *DefaultMetadataStore) EnsureDoesntExistCollection(ctx context.Context, dbname, shardinstance, collectionname string) error
- func (m *DefaultMetadataStore) EnsureDoesntExistCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldname string) error
- func (m *DefaultMetadataStore) EnsureDoesntExistCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) error
- func (m *DefaultMetadataStore) EnsureDoesntExistDatabase(ctx context.Context, dbname string) error
- func (m *DefaultMetadataStore) EnsureDoesntExistShardInstance(ctx context.Context, dbname, shardname string) error
- func (m *DefaultMetadataStore) EnsureExistsCollection(ctx context.Context, db *metadata.Database, ...) error
- func (m *DefaultMetadataStore) EnsureExistsCollectionField(ctx context.Context, db *metadata.Database, ...) error
- func (m *DefaultMetadataStore) EnsureExistsCollectionIndex(ctx context.Context, db *metadata.Database, ...) error
- func (m *DefaultMetadataStore) EnsureExistsDatabase(ctx context.Context, db *metadata.Database) error
- func (m *DefaultMetadataStore) EnsureExistsShardInstance(ctx context.Context, db *metadata.Database, ...) error
- func (m *DefaultMetadataStore) GetMeta(ctx context.Context) (*metadata.Meta, error)
- type HTTPApi
- type HTTPApiConfig
- type MutableStorageMetadataStore
- type StaticMetadataStore
- type StorageMetadataStore
- type StorageNode
- type StorageNodeMetrics
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestMetaStore_Database ¶
Types ¶
type Config ¶
type Config struct { HTTP HTTPApiConfig `yaml:"http_api"` Datasources map[string]*DatasourceInstanceConfig `yaml:"datasource_instances"` }
Common configuration for all storage nodes
func ConfigFromFile ¶
ConfigFromFile returns a *Config after parsing a file path
type DatasourceInstance ¶
type DatasourceInstance struct { Config *DatasourceInstanceConfig MetaStore StorageMetadataStore MutableMetaStore MutableStorageMetadataStore StoreSchema datasource.SchemaInterface Store datasource.DataInterface // contains filtered or unexported fields }
func NewDatasourceInstance ¶
func NewDatasourceInstance(config *DatasourceInstanceConfig, metaStore StorageMetadataStore) (*DatasourceInstance, error)
func NewDatasourceInstanceDefault ¶
func NewDatasourceInstanceDefault(config *DatasourceInstanceConfig) (*DatasourceInstance, error)
Create a DatasourceInstance with a default MetadataStore (based on the same config as the storagenode)
func NewLocalDatasourceInstance ¶
func NewLocalDatasourceInstance(config *DatasourceInstanceConfig, meta *metadata.Meta) (*DatasourceInstance, error)
TODO: remove-- and just have as config options
func (*DatasourceInstance) EnsureDoesntExistCollection ¶
func (s *DatasourceInstance) EnsureDoesntExistCollection(ctx context.Context, dbname, shardinstance, collectionname string) error
func (*DatasourceInstance) EnsureDoesntExistCollectionField ¶
func (s *DatasourceInstance) EnsureDoesntExistCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldname string) error
func (*DatasourceInstance) EnsureDoesntExistCollectionIndex ¶
func (s *DatasourceInstance) EnsureDoesntExistCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) error
func (*DatasourceInstance) EnsureDoesntExistDatabase ¶
func (s *DatasourceInstance) EnsureDoesntExistDatabase(ctx context.Context, dbname string) error
func (*DatasourceInstance) EnsureDoesntExistShardInstance ¶
func (*DatasourceInstance) EnsureExistsCollection ¶
func (s *DatasourceInstance) EnsureExistsCollection(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection) error
func (*DatasourceInstance) EnsureExistsCollectionField ¶
func (s *DatasourceInstance) EnsureExistsCollectionField(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection, field *metadata.CollectionField) error
func (*DatasourceInstance) EnsureExistsCollectionIndex ¶
func (s *DatasourceInstance) EnsureExistsCollectionIndex(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection, index *metadata.CollectionIndex) error
func (*DatasourceInstance) EnsureExistsDatabase ¶
func (*DatasourceInstance) EnsureExistsShardInstance ¶
func (s *DatasourceInstance) EnsureExistsShardInstance(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance) error
func (*DatasourceInstance) GetActiveMeta ¶
func (s *DatasourceInstance) GetActiveMeta() *metadata.Meta
func (*DatasourceInstance) GetMeta ¶
func (s *DatasourceInstance) GetMeta() *metadata.Meta
func (*DatasourceInstance) HandleQuery ¶
func (*DatasourceInstance) HandleStreamQuery ¶
func (s *DatasourceInstance) HandleStreamQuery(ctx context.Context, q *query.Query) *query.ResultStream
TODO: push sort down to the datasource instance (needed to get the stream corect) Handle all stream queries
func (*DatasourceInstance) RefreshMeta ¶
func (s *DatasourceInstance) RefreshMeta() error
func (*DatasourceInstance) Sync ¶
func (s *DatasourceInstance) Sync() error
TODO: remove? since we need to do this while holding the lock it seems useless
type DatasourceInstanceConfig ¶
type DatasourceInstanceConfig struct { // TODO: Rename to driver? Need a consistent name for this StorageNodeType datasource.StorageType `yaml:"storage_type"` StorageConfig map[string]interface{} `yaml:"storage_config"` SkipProvisionTrim bool `yaml:"skip_provision_trim"` Registry metrics.Registry }
func DatasourceInstanceConfigFromFile ¶
func DatasourceInstanceConfigFromFile(filepath string) (*DatasourceInstanceConfig, error)
func (*DatasourceInstanceConfig) GetStore ¶
func (c *DatasourceInstanceConfig) GetStore(metaFunc metadata.MetaFunc) (datasource.DataInterface, error)
type DatasourceInstanceMetrics ¶
type DatasourceInstanceMetrics struct { MetaLastSync *metrics.ObserveArray MetaLastDuration *metrics.ObserveArray QueryTime *metrics.ObserveArray }
func NewDatasourceInstanceMetrics ¶
func NewDatasourceInstanceMetrics(r metrics.Registry) DatasourceInstanceMetrics
type DatasourceInstanceTransport ¶
type DatasourceInstanceTransport struct {
// contains filtered or unexported fields
}
func NewDatasourceInstanceTransport ¶
func NewDatasourceInstanceTransport(dsi *DatasourceInstance) *DatasourceInstanceTransport
func NewStaticDatasourceInstanceTransport ¶
func NewStaticDatasourceInstanceTransport(config *DatasourceInstanceConfig, meta *metadata.Meta) (*DatasourceInstanceTransport, error)
func (*DatasourceInstanceTransport) DoStreamQuery ¶
func (d *DatasourceInstanceTransport) DoStreamQuery(ctx context.Context, q *query.Query) (*query.ResultStream, error)
type DefaultMetadataStore ¶
type DefaultMetadataStore struct {
Store datasource.DataInterface
}
func NewMetadataStore ¶
func NewMetadataStore(config *DatasourceInstanceConfig) (*DefaultMetadataStore, error)
func (*DefaultMetadataStore) EnsureDoesntExistCollection ¶
func (m *DefaultMetadataStore) EnsureDoesntExistCollection(ctx context.Context, dbname, shardinstance, collectionname string) error
func (*DefaultMetadataStore) EnsureDoesntExistCollectionField ¶
func (m *DefaultMetadataStore) EnsureDoesntExistCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldname string) error
func (*DefaultMetadataStore) EnsureDoesntExistCollectionIndex ¶
func (m *DefaultMetadataStore) EnsureDoesntExistCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) error
func (*DefaultMetadataStore) EnsureDoesntExistDatabase ¶
func (m *DefaultMetadataStore) EnsureDoesntExistDatabase(ctx context.Context, dbname string) error
TODO:
func (*DefaultMetadataStore) EnsureDoesntExistShardInstance ¶
func (m *DefaultMetadataStore) EnsureDoesntExistShardInstance(ctx context.Context, dbname, shardname string) error
func (*DefaultMetadataStore) EnsureExistsCollection ¶
func (m *DefaultMetadataStore) EnsureExistsCollection(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection) error
Collection Changes
func (*DefaultMetadataStore) EnsureExistsCollectionField ¶
func (m *DefaultMetadataStore) EnsureExistsCollectionField(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection, field, parentField *metadata.CollectionField) error
func (*DefaultMetadataStore) EnsureExistsCollectionIndex ¶
func (m *DefaultMetadataStore) EnsureExistsCollectionIndex(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection, index *metadata.CollectionIndex) error
Index changes
func (*DefaultMetadataStore) EnsureExistsDatabase ¶
func (*DefaultMetadataStore) EnsureExistsShardInstance ¶
func (m *DefaultMetadataStore) EnsureExistsShardInstance(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance) error
type HTTPApi ¶
type HTTPApi struct {
// contains filtered or unexported fields
}
func NewHTTPApi ¶
func NewHTTPApi(storageNode *StorageNode) *HTTPApi
func (*HTTPApi) Start ¶
func (h *HTTPApi) Start(router *httprouter.Router)
REST API methods:
GET - READ/list PUT - UPDATE POST - CREATE DELETE - DELETE
Register any endpoints to the router
type MutableStorageMetadataStore ¶
type MutableStorageMetadataStore interface { // This is an extension of the base interface, so we need to include it StorageMetadataStore EnsureExistsDatabase(ctx context.Context, db *metadata.Database) error EnsureDoesntExistDatabase(ctx context.Context, dbname string) error EnsureExistsShardInstance(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance) error EnsureDoesntExistShardInstance(ctx context.Context, dbname, shardname string) error EnsureExistsCollection(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection) error EnsureDoesntExistCollection(ctx context.Context, dbname, shardinstance, collectionname string) error EnsureExistsCollectionIndex(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection, index *metadata.CollectionIndex) error EnsureDoesntExistCollectionIndex(ctx context.Context, dbname, shardinstance, collectionname, indexname string) error EnsureExistsCollectionField(ctx context.Context, db *metadata.Database, shardInstance *metadata.ShardInstance, collection *metadata.Collection, field, parentField *metadata.CollectionField) error EnsureDoesntExistCollectionField(ctx context.Context, dbname, shardinstance, collectionname, fieldname string) error }
type StaticMetadataStore ¶
type StaticMetadataStore struct {
// contains filtered or unexported fields
}
func NewStaticMetadataStore ¶
func NewStaticMetadataStore(meta *metadata.Meta) *StaticMetadataStore
func (*StaticMetadataStore) SetMeta ¶
func (s *StaticMetadataStore) SetMeta(m *metadata.Meta)
Our methods
type StorageMetadataStore ¶
type StorageNode ¶
type StorageNode struct { Config *Config Datasources map[string]*DatasourceInstance // contains filtered or unexported fields }
This node is responsible for handling all of the queries for a specific storage node This is also responsible for maintaining schema, indexes, etc. from the metadata store and applying them to the actual storage subsystem
func NewStorageNode ¶
func NewStorageNode(config *Config) (*StorageNode, error)
type StorageNodeMetrics ¶
type StorageNodeMetrics struct { }
func NewStorageNodeMetrics ¶
func NewStorageNodeMetrics(r metrics.Registry) StorageNodeMetrics