directory

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2026 License: Apache-2.0 Imports: 23 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyDiskToObject

func CopyDiskToObject(storageType, rootPath, indexName string) error

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

func CopyObjectToDisk(storageType, rootPath, indexName string) error

CopyObjectToDisk downloads every index item of indexName from the object storage backend of storageType into rootPath.

func DeleteObject

func DeleteObject(storageType, key string) error

DeleteObject removes the object stored under key.

func GetDiskConfig

func GetDiskConfig(rootPath string, indexName string, timeRange ...int64) riot.Config

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

func GetGCSConfig(indexName string, timeRange ...int64) (riot.Config, error)

GetGCSConfig returns a riot config that stores index items in the Google Cloud Storage bucket from config.Global.GCS.

func GetOSSConfig

func GetOSSConfig(indexName string, timeRange ...int64) (riot.Config, error)

GetOSSConfig returns a riot config that stores index items in the Alibaba Cloud OSS bucket from config.Global.OSS.

func GetObject

func GetObject(storageType, key string) ([]byte, error)

GetObject reads the object stored under key.

func GetS3Config

func GetS3Config(indexName string, timeRange ...int64) (riot.Config, error)

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

func ListObjects(storageType, prefix string) ([]string, error)

ListObjects returns the keys stored under prefix, sorted.

func ObjectIndexHasData

func ObjectIndexHasData(storageType, indexName string) (bool, error)

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 PutObject

func PutObject(storageType, key string, data []byte) error

PutObject stores data under key in the backend of storageType.

func RemoveGCSIndex

func RemoveGCSIndex(indexName string) error

RemoveGCSIndex deletes every object stored for the index.

func RemoveOSSIndex

func RemoveOSSIndex(indexName string) error

RemoveOSSIndex deletes every object stored for the index.

func RemoveObjectIndexByType

func RemoveObjectIndexByType(storageType, indexName string) error

RemoveObjectIndexByType deletes every object and cached file of indexName in the backend of storageType.

func RemoveS3Index

func RemoveS3Index(indexName string) error

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 (*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) Put

func (m *MemoryObjectStore) Put(_ context.Context, key string, data []byte) 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) List

func (d *ObjectDirectory) List(kind string) ([]uint64, error)

func (*ObjectDirectory) Load

func (d *ObjectDirectory) Load(kind string, id uint64) (*segment.Data, io.Closer, error)

func (*ObjectDirectory) Lock

func (d *ObjectDirectory) Lock() error

func (*ObjectDirectory) Persist

func (d *ObjectDirectory) Persist(kind string, id uint64, w index.WriterTo, closeCh chan struct{}) error

func (*ObjectDirectory) Remove

func (d *ObjectDirectory) Remove(kind string, id uint64) 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

Jump to

Keyboard shortcuts

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