Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type File ¶
type File struct {
// Keys has all the keys that point to this file
Keys []string
// Signature is the SHA1 of the file
Signature string
// Replica number of replicas for that file
Replica int
// VolumeIDs it's where this file it's replicated to
VolumeIDs []string
// Is the size of the object in bytes
Size int
// TTL is the duration the file has before it'll be automatically deleted
// if 0 it means it has no expiration
TTL time.Duration
// CreatedAt is the time in which the object was created originally
CreatedAt time.Time
}
File represents the structure of a stored File with the Signature (SHA1 of the content of the File) and the key which is the name of the file
func (*File) DeleteVolumeID ¶
DeleteVolumeID removes the vid from the f.VolumeIDs if it does not exists it'll do nothing
type Repository ¶
type Repository interface {
CreateOrReplace(ctx context.Context, f *File) error
FindBySignature(ctx context.Context, sig string) (*File, error)
DeleteBySignature(ctx context.Context, sig string) error
DeleteAll(ctx context.Context) error
All(ctx context.Context) ([]*File, error)
}
Repository is the interface that has to be fulfiled to interact with Files
Click to show internal directories.
Click to hide internal directories.