Documentation ¶
Index ¶
- Constants
- Variables
- type CacheStore
- type ChunkNotifier
- type ChunkUtils
- type ChunkWaiter
- type Config
- type ConfigFile
- type ConfigS3
- type CopyPart
- type DummyStorageServer
- func (f *DummyStorageServer) Base() StorageServer
- func (s *DummyStorageServer) CalculateUsage() (types.Usage, error)
- func (f *DummyStorageServer) Check(dir, address string) (bool, *types.ChunksInfo, int64, time.Time, error)
- func (f *DummyStorageServer) Copy(dir, address string, server StorageServer) error
- func (s *DummyStorageServer) Dir() string
- func (f *DummyStorageServer) Enumerate() ([]types.StoredItem, error)
- func (f *DummyStorageServer) Flush(dir, address string)
- func (f *DummyStorageServer) Get(dir, address string) (io.ReadCloser, *types.ChunksInfo, int64, time.Time, bool, error)
- func (f *DummyStorageServer) Locate(dir, address string) string
- func (f *DummyStorageServer) Move(dir, address string, server StorageServer) error
- func (f *DummyStorageServer) Put(resolve types.Resolver, dir, address string) (string, string, error)
- func (f *DummyStorageServer) PutChunked(resolve types.Resolver, dir, address string, sz uint64) (string, string, error)
- func (f *DummyStorageServer) Remove(dir, address string) error
- func (s *DummyStorageServer) Type() types.StorageType
- type GetResult
- type Logger
- type MetadataStorageServer
- func (s *MetadataStorageServer) Base() StorageServer
- func (s *MetadataStorageServer) Get(dir, address string) (io.ReadCloser, *types.ChunksInfo, int64, time.Time, bool, error)
- func (s *MetadataStorageServer) Put(resolve types.Resolver, dir, address string) (string, string, error)
- func (s *MetadataStorageServer) PutChunked(resolve types.Resolver, dir, address string, sz uint64) (string, string, error)
- type MetadataStorageServerArgs
- type MoveCopyFn
- type StorageServer
Constants ¶
View Source
const ( DefaultChunkPollTimeout = time.Second * 5 DefaultMaxChunkAttempts = 100 )
View Source
const ( StorageTypeFile = types.StorageType("file") StorageTypePostgres = types.StorageType("postgres") StorageTypeS3 = types.StorageType("s3") )
Variables ¶
View Source
var ( ErrNoChunkMetadata = errors.New("metadata not found for chunked asset") ErrNoChunk = errors.New("chunk not found for chunked asset") )
Functions ¶
This section is empty.
Types ¶
type CacheStore ¶
type ChunkNotifier ¶
type ChunkNotifier interface {
Notify(c *types.ChunkNotification) error
}
type ChunkUtils ¶
type ChunkWaiter ¶
type ChunkWaiter interface {
WaitForChunk(c *types.ChunkNotification)
}
type Config ¶
type Config struct { CacheTimeout time.Duration ChunkSizeBytes uint64 S3 *ConfigS3 File *ConfigFile }
type ConfigFile ¶
type ConfigFile struct {
Location string
}
type CopyPart ¶
func NewCopyPart ¶
type DummyStorageServer ¶
type DummyStorageServer struct { GetAttempts int GetReader io.ReadCloser GetOk bool GetChunked *types.ChunksInfo GetSize int64 GetModTime time.Time GetErr error GetMap map[string]GetResult RemoveErr error RemoveMap map[string]bool RemoveCount int Flushed int PutDelay time.Duration PutErr error PutCalled int PutChunks bool Address []string Placed []string Buffer *bytes.Buffer EnumItems []types.StoredItem EnumErr error MoveErr error Moved []string CopyErr error Copied []string Location string MockType types.StorageType MockDir string MockUsage types.Usage MockUsageError error GetCheckLock sync.RWMutex }
func (*DummyStorageServer) Base ¶
func (f *DummyStorageServer) Base() StorageServer
func (*DummyStorageServer) CalculateUsage ¶
func (s *DummyStorageServer) CalculateUsage() (types.Usage, error)
func (*DummyStorageServer) Check ¶
func (f *DummyStorageServer) Check(dir, address string) (bool, *types.ChunksInfo, int64, time.Time, error)
func (*DummyStorageServer) Copy ¶
func (f *DummyStorageServer) Copy(dir, address string, server StorageServer) error
func (*DummyStorageServer) Dir ¶
func (s *DummyStorageServer) Dir() string
func (*DummyStorageServer) Enumerate ¶
func (f *DummyStorageServer) Enumerate() ([]types.StoredItem, error)
func (*DummyStorageServer) Flush ¶
func (f *DummyStorageServer) Flush(dir, address string)
func (*DummyStorageServer) Get ¶
func (f *DummyStorageServer) Get(dir, address string) (io.ReadCloser, *types.ChunksInfo, int64, time.Time, bool, error)
func (*DummyStorageServer) Locate ¶
func (f *DummyStorageServer) Locate(dir, address string) string
func (*DummyStorageServer) Move ¶
func (f *DummyStorageServer) Move(dir, address string, server StorageServer) error
func (*DummyStorageServer) PutChunked ¶
func (*DummyStorageServer) Remove ¶
func (f *DummyStorageServer) Remove(dir, address string) error
func (*DummyStorageServer) Type ¶
func (s *DummyStorageServer) Type() types.StorageType
type GetResult ¶
type GetResult struct { GetReader io.ReadCloser GetOk bool GetChunked *types.ChunksInfo GetSize int64 GetModTime time.Time GetErr error }
type MetadataStorageServer ¶
type MetadataStorageServer struct { StorageServer // contains filtered or unexported fields }
MetadataStorageServer overrides the `Get` and `Put` methods for interacting with the database to record access times.
func (*MetadataStorageServer) Base ¶
func (s *MetadataStorageServer) Base() StorageServer
func (*MetadataStorageServer) Get ¶
func (s *MetadataStorageServer) Get(dir, address string) (io.ReadCloser, *types.ChunksInfo, int64, time.Time, bool, error)
func (*MetadataStorageServer) PutChunked ¶
type MetadataStorageServerArgs ¶
type MetadataStorageServerArgs struct { Name string Server StorageServer Store CacheStore }
type MoveCopyFn ¶
type MoveCopyFn func(dir, address string, server StorageServer) error
type StorageServer ¶
type StorageServer interface { // Check to see if an item exists // Accepts: // * dir The prefix or directory in which to look // * address The address of the item // Returns: // * bool `true` if found // * ChunkInfo if chunked // * int64 the file size if known // * time.Time the last modification time if known // * error Check(dir, address string) (bool, *types.ChunksInfo, int64, time.Time, error) // Dir will present the underlying "directory" for a // storage server. This doesn't make sense for all server // types, but for interface reasons we need it. Dir() string // Type will present the "type" of server implementation. Type() types.StorageType // CalculateUsage will look at the underlying storage and // report information about the usage. CalculateUsage() (types.Usage, error) // Get an item if it exists // Accepts: // * dir The prefix or directory in which to look // * address The address of the item // Returns: // * io.ReadCloser the file // * int64 The size of the file // * time.Time The last modification time // * bool `true` if found // * error Get(dir, address string) (io.ReadCloser, *types.ChunksInfo, int64, time.Time, bool, error) // Put writes an item. Creates a file // named `address`, and then passes the file writer // to the provided `resolve` function for writing. // See `cache/runners` for a number of queue runners // that are responsible for using this method to store // data Put(resolve types.Resolver, dir, address string) (string, string, error) // PutChunked writes an item. Creates a directory // named `address`, and then passes the file writer // to the provided `resolve` function for writing. The // data will be written to the directly in a series // of chunk files of fixed size. The `dir`, `address`, and // `sz` parameters must all be included, unlike the regular // Put method, which allows post-determined location and size. PutChunked(resolve types.Resolver, dir, address string, sz uint64) (string, string, error) // Remove an item Remove(dir, address string) error // Flush the NFS cache while waiting for an // item to appear Flush(dir, address string) // Enumerate all items in storage Enumerate() ([]types.StoredItem, error) // Move an item from one storage system to another Move(dir, address string, server StorageServer) error // Copy an item from one storage system to another Copy(dir, address string, server StorageServer) error // Locate returns the storage location for a given dir, address Locate(dir, address string) string // Base returns the base storage server in case the server is wrapped Base() StorageServer }
The StorageServer provides an interface to the file system for:
(a) The FileCache in `file.go` (gets data from the cache) (b) The Runners in `cache/runners` (put data into the cache)
func NewMetadataStorageServer ¶
func NewMetadataStorageServer(args MetadataStorageServerArgs) StorageServer
Click to show internal directories.
Click to hide internal directories.