Documentation
¶
Index ¶
- func CopyDiskToObject(storageType, rootPath, indexName string) error
- func CopyObjectToDisk(storageType, rootPath, indexName string) error
- func DeleteObject(storageType, key string) error
- func GetDiskConfig(rootPath string, indexName string, timeRange ...int64) riot.Config
- func GetGCSConfig(indexName string, timeRange ...int64) (riot.Config, error)
- func GetOSSConfig(indexName string, timeRange ...int64) (riot.Config, error)
- func GetObject(storageType, key string) ([]byte, error)
- func GetS3Config(indexName string, timeRange ...int64) (riot.Config, error)
- func ListObjects(storageType, prefix string) ([]string, error)
- func ObjectIndexHasData(storageType, indexName string) (bool, error)
- func PutObject(storageType, key string, data []byte) error
- func RemoveGCSIndex(indexName string) error
- func RemoveOSSIndex(indexName string) error
- func RemoveObjectIndexByType(storageType, indexName string) error
- func RemoveS3Index(indexName string) error
- func SetTestObjectStore(storageType string, store *MemoryObjectStore) (func(), error)
- type MemoryObjectStore
- func (m *MemoryObjectStore) Delete(_ context.Context, key string) error
- func (m *MemoryObjectStore) Get(_ context.Context, key string) (io.ReadCloser, error)
- func (m *MemoryObjectStore) Gets() int
- func (m *MemoryObjectStore) Len(prefix string) int
- func (m *MemoryObjectStore) List(_ context.Context, prefix string) ([]objectInfo, error)
- func (m *MemoryObjectStore) Put(_ context.Context, key string, data []byte) error
- func (m *MemoryObjectStore) SetErr(err error)
- type ObjectDirectory
- func (d *ObjectDirectory) List(kind string) ([]uint64, error)
- func (d *ObjectDirectory) Load(kind string, id uint64) (*segment.Data, io.Closer, error)
- func (d *ObjectDirectory) Lock() error
- func (d *ObjectDirectory) Persist(kind string, id uint64, w index.WriterTo, closeCh chan struct{}) error
- func (d *ObjectDirectory) Remove(kind string, id uint64) error
- func (d *ObjectDirectory) Setup(readOnly bool) error
- func (d *ObjectDirectory) Stats() (numItems uint64, numBytes uint64)
- func (d *ObjectDirectory) Sync() error
- func (d *ObjectDirectory) Unlock() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CopyDiskToObject ¶
CopyDiskToObject uploads every index item of indexName found under rootPath to the object storage backend of storageType. Items are immutable and keyed by name, so re-running after a partial copy simply overwrites what it re-uploads.
func CopyObjectToDisk ¶
CopyObjectToDisk downloads every index item of indexName from the object storage backend of storageType into rootPath.
func DeleteObject ¶
DeleteObject removes the object stored under key.
func GetDiskConfig ¶
GetDiskConfig returns a bluge config that will store index data in local disk rootPath: the root path of data indexName: the name of the index to use.
func GetGCSConfig ¶
GetGCSConfig returns a riot config that stores index items in the Google Cloud Storage bucket from config.Global.GCS.
func GetOSSConfig ¶
GetOSSConfig returns a riot config that stores index items in the Alibaba Cloud OSS bucket from config.Global.OSS.
func GetS3Config ¶
GetS3Config returns a riot config that stores index items as objects under "<indexName>/" in the bucket from config.Global.S3. Works with AWS S3, MinIO or any S3-compatible service.
func ListObjects ¶
ListObjects returns the keys stored under prefix, sorted.
func ObjectIndexHasData ¶
ObjectIndexHasData reports whether indexName has any index item stored, as opposed to only the directory marker of a shard that was never written to.
func RemoveGCSIndex ¶
RemoveGCSIndex deletes every object stored for the index.
func RemoveOSSIndex ¶
RemoveOSSIndex deletes every object stored for the index.
func RemoveObjectIndexByType ¶
RemoveObjectIndexByType deletes every object and cached file of indexName in the backend of storageType.
func RemoveS3Index ¶
RemoveS3Index deletes every object stored for the index.
func SetTestObjectStore ¶
func SetTestObjectStore(storageType string, store *MemoryObjectStore) (func(), error)
SetTestObjectStore installs store as the backend of storageType and returns a function restoring the previous one. It exists so packages outside directory can exercise the object storage paths without a real bucket.
Types ¶
type MemoryObjectStore ¶
type MemoryObjectStore struct {
// contains filtered or unexported fields
}
MemoryObjectStore is an in-memory objectStore used by tests, in this package and, through SetTestObjectStore, by packages that only see the exported API.
func NewMemoryObjectStore ¶
func NewMemoryObjectStore() *MemoryObjectStore
func (*MemoryObjectStore) Delete ¶
func (m *MemoryObjectStore) Delete(_ context.Context, key string) error
func (*MemoryObjectStore) Get ¶
func (m *MemoryObjectStore) Get(_ context.Context, key string) (io.ReadCloser, error)
func (*MemoryObjectStore) Gets ¶
func (m *MemoryObjectStore) Gets() int
Gets returns how many objects were fetched from the store.
func (*MemoryObjectStore) Len ¶
func (m *MemoryObjectStore) Len(prefix string) int
Len returns how many objects are stored under prefix.
func (*MemoryObjectStore) List ¶
func (m *MemoryObjectStore) List(_ context.Context, prefix string) ([]objectInfo, error)
func (*MemoryObjectStore) SetErr ¶
func (m *MemoryObjectStore) SetErr(err error)
SetErr makes List and Get fail with err; nil clears the failure.
type ObjectDirectory ¶
type ObjectDirectory struct {
// contains filtered or unexported fields
}
ObjectDirectory implements index.Directory on top of an objectStore. With a cache, items are kept as local files and memory-mapped; without one they are loaded fully into memory on every open.
func NewObjectDirectory ¶
func NewObjectDirectory(store objectStore, cache *fileCache, indexName string) *ObjectDirectory
func (*ObjectDirectory) Lock ¶
func (d *ObjectDirectory) Lock() error
func (*ObjectDirectory) Setup ¶
func (d *ObjectDirectory) Setup(readOnly bool) error
func (*ObjectDirectory) Stats ¶
func (d *ObjectDirectory) Stats() (numItems uint64, numBytes uint64)
func (*ObjectDirectory) Sync ¶
func (d *ObjectDirectory) Sync() error
func (*ObjectDirectory) Unlock ¶
func (d *ObjectDirectory) Unlock() error