Documentation
¶
Index ¶
- Variables
- func GenerateKey(elems ...string) string
- func TransferFiles(ctx context.Context, fs filesystem.FS, dst, src string) (destFile string, err error)
- type AbstractSharedCacheRepository
- func (c *AbstractSharedCacheRepository) EntriesCount(ctx context.Context) (count int64, err error)
- func (c *AbstractSharedCacheRepository) GenerateKey(elems ...string) string
- func (c *AbstractSharedCacheRepository) GetEntries(ctx context.Context) (entries []string, err error)
- func (c *AbstractSharedCacheRepository) RemoveEntry(ctx context.Context, key string) error
- type CacheType
- type Configuration
- type FileWithModTime
- type ISharedCacheRepository
- type SharedImmutableCacheRepository
- func (s *SharedImmutableCacheRepository) CleanEntry(ctx context.Context, key string) (err error)
- func (s *SharedImmutableCacheRepository) Fetch(ctx context.Context, key, dest string) (err error)
- func (s *SharedImmutableCacheRepository) GetEntryAge(ctx context.Context, key string) (age time.Duration, err error)
- func (s *SharedImmutableCacheRepository) SetEntryAge(ctx context.Context, key string, age time.Duration) error
- func (s *SharedImmutableCacheRepository) Store(ctx context.Context, key, src string) (err error)
- type SharedMutableCacheRepository
- func (s *SharedMutableCacheRepository) CleanEntry(ctx context.Context, key string) error
- func (s *SharedMutableCacheRepository) Fetch(ctx context.Context, key, dest string) (err error)
- func (s *SharedMutableCacheRepository) GetEntryAge(ctx context.Context, key string) (time.Duration, error)
- func (s *SharedMutableCacheRepository) SetEntryAge(ctx context.Context, key string, age time.Duration) error
- func (s *SharedMutableCacheRepository) Store(ctx context.Context, key, src string) (err error)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
CacheTypes = []CacheType{CacheMutable, CacheImmutable}
)
Functions ¶
func GenerateKey ¶
GenerateKey generates a key based on a list of key elements `elems`.
func TransferFiles ¶
func TransferFiles(ctx context.Context, fs filesystem.FS, dst, src string) (destFile string, err error)
TransferFiles transfers a file from a location `src` to another `dest` and ensures the integrity (i.e. hash validation) of what was copied across. `dest` can be a file or a directory. If not existent, it will be created on the fly. non-existent directory path should be terminated by a path separator i.e. / or \
Types ¶
type AbstractSharedCacheRepository ¶
type AbstractSharedCacheRepository struct {
// contains filtered or unexported fields
}
AbstractSharedCacheRepository defines an abstract cache repository.
func NewAbstractSharedCacheRepository ¶
func NewAbstractSharedCacheRepository(cfg *Configuration, fs filesystem.FS) (cache *AbstractSharedCacheRepository, err error)
func (*AbstractSharedCacheRepository) EntriesCount ¶
func (c *AbstractSharedCacheRepository) EntriesCount(ctx context.Context) (count int64, err error)
func (*AbstractSharedCacheRepository) GenerateKey ¶
func (c *AbstractSharedCacheRepository) GenerateKey(elems ...string) string
func (*AbstractSharedCacheRepository) GetEntries ¶
func (c *AbstractSharedCacheRepository) GetEntries(ctx context.Context) (entries []string, err error)
func (*AbstractSharedCacheRepository) RemoveEntry ¶
func (c *AbstractSharedCacheRepository) RemoveEntry(ctx context.Context, key string) error
type Configuration ¶
type Configuration struct { RemoteStoragePath string `mapstructure:"remote_storage_path"` // Path where the cache will be stored. Timeout time.Duration `mapstructure:"timeout"` // Cache timeout if need be FilesystemItemsToIgnore string `mapstructure:"ignore_fs_items"` // List of files/folders to ignore (pattern list separated by commas) }
func DefaultSharedCacheConfiguration ¶
func DefaultSharedCacheConfiguration() *Configuration
func (*Configuration) Validate ¶
func (cfg *Configuration) Validate() error
type FileWithModTime ¶
type FileWithModTime struct {
// contains filtered or unexported fields
}
type ISharedCacheRepository ¶
type ISharedCacheRepository interface { string) string Fetch(ctx context.Context, key, dest string) error Store(ctx context.Context, key, src string) error CleanEntry(ctx context.Context, key string) error RemoveEntry(ctx context.Context, key string) error GetEntryAge(ctx context.Context, key string) (age time.Duration, err error) SetEntryAge(ctx context.Context, key string, age time.Duration) error GetEntries(ctx context.Context) (entries []string, err error) EntriesCount(ctx context.Context) (int64, error) }GenerateKey(elems ...
ISharedCacheRepository defines a cache stored on a remote location and shared by separate processes.
func NewCache ¶
func NewCache(cacheType CacheType, fs filesystem.FS, cfg *Configuration) (ISharedCacheRepository, error)
func NewSharedMutableCacheRepository ¶
func NewSharedMutableCacheRepository(cfg *Configuration, fs filesystem.FS) (repository ISharedCacheRepository, err error)
type SharedImmutableCacheRepository ¶
type SharedImmutableCacheRepository struct {
}func NewSharedImmutableCacheRepository ¶
func NewSharedImmutableCacheRepository(cfg *Configuration, fs filesystem.FS) (repository *SharedImmutableCacheRepository, err error)
func (*SharedImmutableCacheRepository) CleanEntry ¶
func (s *SharedImmutableCacheRepository) CleanEntry(ctx context.Context, key string) (err error)
func (*SharedImmutableCacheRepository) Fetch ¶
func (s *SharedImmutableCacheRepository) Fetch(ctx context.Context, key, dest string) (err error)
func (*SharedImmutableCacheRepository) GetEntryAge ¶
func (*SharedImmutableCacheRepository) SetEntryAge ¶
type SharedMutableCacheRepository ¶
type SharedMutableCacheRepository struct { // contains filtered or unexported fields }
SharedMutableCacheRepository defines a shared cache using a distributed lock system solely based on lock files.
func (*SharedMutableCacheRepository) CleanEntry ¶
func (s *SharedMutableCacheRepository) CleanEntry(ctx context.Context, key string) error
func (*SharedMutableCacheRepository) Fetch ¶
func (s *SharedMutableCacheRepository) Fetch(ctx context.Context, key, dest string) (err error)
func (*SharedMutableCacheRepository) GetEntryAge ¶
func (*SharedMutableCacheRepository) SetEntryAge ¶
Click to show internal directories.
Click to hide internal directories.