metastore

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2022 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MetastoreEventType_name = map[MetastoreEventType]string{
		MetastoreEventTypeUnknown:     "unknown",
		MetastoreEventTypePutIndex:    "put_index",
		MetastoreEventTypeDeleteIndex: "delete_index",
		MetastoreEventTypePutShard:    "put_shard",
		MetastoreEventTypeDeleteShard: "delete_shard",
	}
	MetastoreEventType_value = map[string]MetastoreEventType{
		"unknown":      MetastoreEventTypeUnknown,
		"put_index":    MetastoreEventTypePutIndex,
		"delete_index": MetastoreEventTypeDeleteIndex,
		"put_shard":    MetastoreEventTypePutShard,
		"delete_shard": MetastoreEventTypeDeleteShard,
	}
)

Event value maps for MetastoreEventType.

View Source
var (
	SchemeType_name = map[SchemeType]string{
		SchemeTypeUnknown:  "unknown",
		SchemeTypeFile:     "file",
		SchemeTypeEtcd:     "etcd",
		SchemeTypeDynamodb: "dynamodb",
	}
	SchemeType_value = map[string]SchemeType{
		"unknown":  SchemeTypeUnknown,
		"file":     SchemeTypeFile,
		"etcd":     SchemeTypeEtcd,
		"dynamodb": SchemeTypeDynamodb,
	}
)

Enum value maps for SchemeType.

View Source
var (
	StorageEventType_name = map[StorageEventType]string{
		StorageEventTypeUnknown: "unknown",
		StorageEventTypePut:     "put",
		StorageEventTypeDelete:  "delete",
	}
	StorageEventType_value = map[string]StorageEventType{
		"unknown": StorageEventTypeUnknown,
		"put":     StorageEventTypePut,
		"delete":  StorageEventTypeDelete,
	}
)

Enum value maps for StorageEventType.

View Source
var (
	// ErrRecordNotFound returned when a get returns no results
	ErrRecordNotFound = errors.New("record not found")

	// ErrDuplicateRecord returned when a conflict occurs putting a record due to duplicate
	ErrDuplicateRecord = errors.New("record already exists")
)

Functions

This section is empty.

Types

type DynamodbStorage added in v0.4.0

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

func NewDynamodbStorage added in v0.4.0

func NewDynamodbStorage(uri string, logger *zap.Logger) (*DynamodbStorage, error)

func (*DynamodbStorage) Close added in v0.4.0

func (m *DynamodbStorage) Close() error

func (*DynamodbStorage) Delete added in v0.4.0

func (m *DynamodbStorage) Delete(path string) error

func (*DynamodbStorage) Exists added in v0.4.0

func (m *DynamodbStorage) Exists(path string) (bool, error)

func (*DynamodbStorage) Get added in v0.4.0

func (m *DynamodbStorage) Get(path string) ([]byte, error)

func (*DynamodbStorage) List added in v0.4.0

func (m *DynamodbStorage) List(prefix string) ([]string, error)

func (*DynamodbStorage) Put added in v0.4.0

func (m *DynamodbStorage) Put(path string, value []byte) error

type EtcdStorage

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

func NewEtcdStorageWithUri

func NewEtcdStorageWithUri(uri string, logger *zap.Logger) (*EtcdStorage, error)

func (*EtcdStorage) Close

func (m *EtcdStorage) Close() error

func (*EtcdStorage) Delete

func (m *EtcdStorage) Delete(path string) error

func (*EtcdStorage) Exists

func (m *EtcdStorage) Exists(path string) (bool, error)

func (*EtcdStorage) Get

func (m *EtcdStorage) Get(path string) ([]byte, error)

func (*EtcdStorage) List

func (m *EtcdStorage) List(prefix string) ([]string, error)

func (*EtcdStorage) Put

func (m *EtcdStorage) Put(path string, content []byte) error

type FileSystemStorage

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

func NewFileSystemStorageWithPath

func NewFileSystemStorageWithPath(path string, logger *zap.Logger) (*FileSystemStorage, error)

func NewFileSystemStorageWithUri

func NewFileSystemStorageWithUri(uri string, logger *zap.Logger) (*FileSystemStorage, error)

func (*FileSystemStorage) Close

func (m *FileSystemStorage) Close() error

func (*FileSystemStorage) Delete

func (m *FileSystemStorage) Delete(path string) error

func (*FileSystemStorage) Exists

func (m *FileSystemStorage) Exists(path string) (bool, error)

func (*FileSystemStorage) Get

func (m *FileSystemStorage) Get(path string) ([]byte, error)

func (*FileSystemStorage) List

func (m *FileSystemStorage) List(prefix string) ([]string, error)

func (*FileSystemStorage) Put

func (m *FileSystemStorage) Put(path string, content []byte) error

type IndexMetadata

type IndexMetadata struct {
	IndexName           string                    `json:"index_name"`
	IndexUri            string                    `json:"index_uri"`
	IndexLockUri        string                    `json:"index_lock_uri"`
	IndexMapping        mapping.IndexMapping      `json:"index_mapping"`
	IndexMappingVersion int64                     `json:"index_mapping_version"`
	DefaultSearchField  string                    `json:"default_search_field"`
	DefaultAnalyzer     analyzer.AnalyzerSetting  `json:"default_analyzer"`
	ShardMetadataMap    map[string]*ShardMetadata `json:"-"`
}

func NewIndexMetadataWithBytes

func NewIndexMetadataWithBytes(bytes []byte) (*IndexMetadata, error)

func (*IndexMetadata) Marshal

func (m *IndexMetadata) Marshal() ([]byte, error)

type Metastore

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

func NewMetastore

func NewMetastore(storage Storage, logger *zap.Logger) (*Metastore, error)

func NewMetastoreWithUri

func NewMetastoreWithUri(uri string, logger *zap.Logger) (*Metastore, error)

func (*Metastore) Close

func (m *Metastore) Close() error

func (*Metastore) DeleteIndexMetadata

func (m *Metastore) DeleteIndexMetadata(indexName string) error

func (*Metastore) Events

func (m *Metastore) Events() chan MetastoreEvent

func (*Metastore) GetIndexMetadata

func (m *Metastore) GetIndexMetadata(indexName string) (*IndexMetadata, error)

func (*Metastore) GetIndexNames

func (m *Metastore) GetIndexNames() []string

func (*Metastore) GetMapping

func (m *Metastore) GetMapping(indexName string) (mapping.IndexMapping, error)

func (*Metastore) GetResponsibleShard

func (m *Metastore) GetResponsibleShard(indexName string, key string) string

func (*Metastore) GetShardMetadata

func (m *Metastore) GetShardMetadata(indexName string, shardName string) (*ShardMetadata, error)

func (*Metastore) GetShardNames

func (m *Metastore) GetShardNames(indexName string) []string

func (*Metastore) IndexMetadataExists

func (m *Metastore) IndexMetadataExists(indexName string) bool

func (*Metastore) NumShards

func (m *Metastore) NumShards(indexName string) int

func (*Metastore) SetIndexMetadata

func (m *Metastore) SetIndexMetadata(indexName string, indexMetadata *IndexMetadata) error

func (*Metastore) TouchShardMetadata

func (m *Metastore) TouchShardMetadata(indexName string, shardName string) error

type MetastoreEvent

type MetastoreEvent struct {
	Type  MetastoreEventType
	Index string
	Shard string
}

type MetastoreEventType

type MetastoreEventType int
const (
	MetastoreEventTypeUnknown MetastoreEventType = iota
	MetastoreEventTypePutIndex
	MetastoreEventTypeDeleteIndex
	MetastoreEventTypePutShard
	MetastoreEventTypeDeleteShard
)

type SchemeType

type SchemeType int
const (
	SchemeTypeUnknown SchemeType = iota
	SchemeTypeFile
	SchemeTypeEtcd
	SchemeTypeDynamodb
)

type ShardMetadata

type ShardMetadata struct {
	ShardName    string `json:"shard_name"`
	ShardUri     string `json:"shard_uri"`
	ShardLockUri string `json:"shard_lock_uri"`
	ShardVersion int64  `json:"shard_update_timestamp"`
}

func NewShardMetadataWithBytes

func NewShardMetadataWithBytes(bytes []byte) (*ShardMetadata, error)

func (*ShardMetadata) Marshal

func (m *ShardMetadata) Marshal() ([]byte, error)

type Storage

type Storage interface {
	Get(key string) ([]byte, error)
	List(prefix string) ([]string, error)
	Put(key string, value []byte) error
	Delete(key string) error
	Exists(key string) (bool, error)
	Close() error
}

func NewStorageWithUri

func NewStorageWithUri(uri string, logger *zap.Logger) (Storage, error)

type StorageEvent

type StorageEvent struct {
	Type  StorageEventType
	Path  string
	Value []byte
}

type StorageEventType

type StorageEventType int
const (
	StorageEventTypeUnknown StorageEventType = iota
	StorageEventTypePut
	StorageEventTypeDelete
)

Jump to

Keyboard shortcuts

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