Documentation ¶
Index ¶
- Variables
- func ValidatePath(path string) error
- type BigCacheStorage
- func (f *BigCacheStorage) Delete(ctx context.Context, logicalPath string) error
- func (f *BigCacheStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
- func (f *BigCacheStorage) List(ctx context.Context, prefix string) ([]string, error)
- func (f *BigCacheStorage) Put(ctx context.Context, e StorageEntry) error
- type CacheableStorage
- func (c *CacheableStorage) Delete(ctx context.Context, logicalPath string) error
- func (c *CacheableStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
- func (c *CacheableStorage) List(ctx context.Context, prefix string) ([]string, error)
- func (c *CacheableStorage) Put(ctx context.Context, e StorageEntry) error
- type FileStorage
- func (f *FileStorage) Delete(ctx context.Context, logicalPath string) error
- func (f *FileStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
- func (f *FileStorage) List(ctx context.Context, prefix string) ([]string, error)
- func (f *FileStorage) Put(ctx context.Context, e StorageEntry) error
- type GCSStorage
- func (s *GCSStorage) Delete(ctx context.Context, logicalPath string) error
- func (s *GCSStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
- func (s *GCSStorage) List(ctx context.Context, prefix string) ([]string, error)
- func (s *GCSStorage) Put(ctx context.Context, e StorageEntry) (retErr error)
- type InheritableStorage
- func (s *InheritableStorage) Delete(ctx context.Context, logicalPath string) error
- func (s *InheritableStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
- func (s *InheritableStorage) List(ctx context.Context, prefix string) ([]string, error)
- func (s *InheritableStorage) Put(ctx context.Context, e StorageEntry) error
- type NotFoundError
- type Storage
- func NewBigCacheStorage(config map[string]string) (Storage, error)
- func NewCacheableStorage(cache Storage, source Storage) (Storage, error)
- func NewCacheableStorageWithConf(conf map[string]string) (Storage, error)
- func NewFileStorage(conf map[string]string) (Storage, error)
- func NewGCSStorage(conf map[string]string) (Storage, error)
- func NewInheritableStorage(source Storage) (Storage, error)
- type StorageCreator
- type StorageEntry
Constants ¶
This section is empty.
Variables ¶
var CacheableStorageOptions = map[string]StorageCreator{ "file": NewFileStorage, "bigcache": NewBigCacheStorage, "gcs": NewGCSStorage, }
CacheableStorageOptions is a map of available storage options specified at the server.options.cache config path
var StorageOptions = map[string]StorageCreator{ "file": NewFileStorage, "bigcache": NewBigCacheStorage, "cacheable": NewCacheableStorageWithConf, "gcs": NewGCSStorage, }
StorageOptions is a map of available storage options specified at the server.storage config path
Functions ¶
func ValidatePath ¶
Types ¶
type BigCacheStorage ¶
type BigCacheStorage struct {
// contains filtered or unexported fields
}
func (*BigCacheStorage) Delete ¶
func (f *BigCacheStorage) Delete(ctx context.Context, logicalPath string) error
func (*BigCacheStorage) Get ¶
func (f *BigCacheStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
func (*BigCacheStorage) Put ¶
func (f *BigCacheStorage) Put(ctx context.Context, e StorageEntry) error
type CacheableStorage ¶
type CacheableStorage struct {
// contains filtered or unexported fields
}
CacheableStorage is a wrapper storage used for providing a write-through cache. This allows any storage type to be used on top, however, in-memory storage types are recommended to reduce latency. Size and implementation details of the cache layer will be up to the consumer.
func (*CacheableStorage) Delete ¶
func (c *CacheableStorage) Delete(ctx context.Context, logicalPath string) error
func (*CacheableStorage) Get ¶
func (c *CacheableStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
func (*CacheableStorage) Put ¶
func (c *CacheableStorage) Put(ctx context.Context, e StorageEntry) error
type FileStorage ¶
type FileStorage struct {
// contains filtered or unexported fields
}
func (*FileStorage) Delete ¶
func (f *FileStorage) Delete(ctx context.Context, logicalPath string) error
func (*FileStorage) Get ¶
func (f *FileStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
func (*FileStorage) Put ¶
func (f *FileStorage) Put(ctx context.Context, e StorageEntry) error
type GCSStorage ¶ added in v0.0.22
type GCSStorage struct {
// contains filtered or unexported fields
}
func (*GCSStorage) Delete ¶ added in v0.0.22
func (s *GCSStorage) Delete(ctx context.Context, logicalPath string) error
func (*GCSStorage) Get ¶ added in v0.0.22
func (s *GCSStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
func (*GCSStorage) Put ¶ added in v0.0.22
func (s *GCSStorage) Put(ctx context.Context, e StorageEntry) (retErr error)
type InheritableStorage ¶ added in v0.0.21
type InheritableStorage struct {
// contains filtered or unexported fields
}
func (*InheritableStorage) Delete ¶ added in v0.0.21
func (s *InheritableStorage) Delete(ctx context.Context, logicalPath string) error
func (*InheritableStorage) Get ¶ added in v0.0.21
func (s *InheritableStorage) Get(ctx context.Context, logicalPath string) (*StorageEntry, error)
func (*InheritableStorage) Put ¶ added in v0.0.21
func (s *InheritableStorage) Put(ctx context.Context, e StorageEntry) error
type NotFoundError ¶
type NotFoundError struct {
Key string
}
func (*NotFoundError) Error ¶
func (nf *NotFoundError) Error() string
type Storage ¶
type Storage interface { // Get retrieves the entry by key from the underlying storage Get(ctx context.Context, key string) (*StorageEntry, error) // Put adds the entry to the underlying storage Put(ctx context.Context, e StorageEntry) error // Delete removes the entry by key from the underlying storage Delete(ctx context.Context, key string) error // List returns a slice of paths at the specified prefix List(ctx context.Context, prefix string) ([]string, error) }
func NewCacheableStorage ¶
NewCacheableStorage returns a write-through cacheable storage.
func NewInheritableStorage ¶ added in v0.0.21
NewInheritableStorage returns a InheritableStorage with the source Storage
type StorageCreator ¶
StorageCreator is a factory function to be used for all storage types