Documentation
¶
Index ¶
- Constants
- Variables
- func Backends() []string
- func Deserialize(hasher hash.Hash, resourceType resources.Type, input io.ReadCloser) (versioning.Version, io.ReadCloser, error)
- func Register(name string, flags location.Flags, backend StoreFn) error
- func Serialize(hasher hash.Hash, resourceType resources.Type, version versioning.Version, ...) (io.Reader, error)
- func Unregister(name string) error
- type Configuration
- type Mode
- type Store
- type StoreFn
Constants ¶
View Source
const ( DEFAULT_HASHING_ALGORITHM = hashing.DEFAULT_HASHING_ALGORITHM STORAGE_HEADER_SIZE uint32 = 16 STORAGE_FOOTER_SIZE uint32 = 32 )
View Source
const ( PHASE_HEADER = iota PHASE_DATA PHASE_FOOTER )
View Source
const VERSION string = "1.0.0"
Variables ¶
View Source
var ErrInvalidLocation = fmt.Errorf("invalid location")
View Source
var ErrInvalidMagic = fmt.Errorf("invalid magic")
View Source
var ErrInvalidVersion = fmt.Errorf("invalid version")
View Source
var ErrNotReadable = fmt.Errorf("storage is not readable")
View Source
var ErrNotWritable = fmt.Errorf("storage is not writable")
Functions ¶
func Deserialize ¶
func Deserialize(hasher hash.Hash, resourceType resources.Type, input io.ReadCloser) (versioning.Version, io.ReadCloser, error)
func Unregister ¶
Types ¶
type Configuration ¶
type Configuration struct {
Version versioning.Version `msgpack:"-" json:"version"`
Timestamp time.Time `json:"timestamp"`
RepositoryID uuid.UUID `json:"repository_id"`
Packfile packfile.Configuration `json:"packfile"`
Chunking chunking.Configuration `json:"chunking"`
Hashing hashing.Configuration `json:"hashing"`
Compression *compression.Configuration `json:"compression"`
Encryption *encryption.Configuration `json:"encryption"`
}
func NewConfiguration ¶
func NewConfiguration() *Configuration
func NewConfigurationFromBytes ¶
func NewConfigurationFromBytes(version versioning.Version, data []byte) (*Configuration, error)
func NewConfigurationFromWrappedBytes ¶
func NewConfigurationFromWrappedBytes(data []byte) (*Configuration, error)
func (*Configuration) ToBytes ¶
func (c *Configuration) ToBytes() ([]byte, error)
type Store ¶
type Store interface {
Create(ctx context.Context, config []byte) error
Open(ctx context.Context) ([]byte, error)
Location(ctx context.Context) (string, error)
Mode(ctx context.Context) (Mode, error)
Size(ctx context.Context) (int64, error) // this can be costly, call with caution
GetStates(ctx context.Context) ([]objects.MAC, error)
PutState(ctx context.Context, mac objects.MAC, rd io.Reader) (int64, error)
GetState(ctx context.Context, mac objects.MAC) (io.ReadCloser, error)
DeleteState(ctx context.Context, mac objects.MAC) error
GetPackfiles(ctx context.Context) ([]objects.MAC, error)
PutPackfile(ctx context.Context, mac objects.MAC, rd io.Reader) (int64, error)
GetPackfile(ctx context.Context, mac objects.MAC) (io.ReadCloser, error)
GetPackfileBlob(ctx context.Context, mac objects.MAC, offset uint64, length uint32) (io.ReadCloser, error)
DeletePackfile(ctx context.Context, mac objects.MAC) error
GetLocks(ctx context.Context) ([]objects.MAC, error)
PutLock(ctx context.Context, lockID objects.MAC, rd io.Reader) (int64, error)
GetLock(ctx context.Context, lockID objects.MAC) (io.ReadCloser, error)
DeleteLock(ctx context.Context, lockID objects.MAC) error
Close(ctx context.Context) error
}
Click to show internal directories.
Click to hide internal directories.