Documentation
¶
Index ¶
- Constants
- Variables
- func ReadScopesByPermission(scope auth.CacheScope) []string
- func WriteScope(scope auth.CacheScope) (string, bool)
- type BlockListCommit
- type ByteRange
- type CapacityTrigger
- type CreateUploadResult
- type DownloadError
- type DownloadMetadata
- type DownloadRange
- type DownloadStream
- type MatchResult
- type Options
- type RangeNotSatisfiableError
- type Service
- func (s *Service) CommitBlockList(ctx context.Context, uploadID int64, blockIDs []string) error
- func (s *Service) CompleteUpload(ctx context.Context, key, version string, scope auth.CacheScope) (int64, error)
- func (s *Service) CreateUpload(ctx context.Context, key, version string, scope auth.CacheScope) (*CreateUploadResult, error)
- func (s *Service) Download(ctx context.Context, cacheEntryID string) (*DownloadStream, error)
- func (s *Service) DownloadMetadata(ctx context.Context, cacheEntryID string) (*DownloadMetadata, error)
- func (s *Service) DownloadRanged(ctx context.Context, cacheEntryID string, ranges []ByteRange) (*DownloadStream, error)
- func (s *Service) GetCacheEntryWithDownloadURL(ctx context.Context, keys []string, version string, scope auth.CacheScope, ...) (*MatchResult, error)
- func (s *Service) MatchCacheEntry(ctx context.Context, keys []string, version string, scope auth.CacheScope) (*ent.CacheEntry, error)
- func (s *Service) PrepareBlockListCommit(ctx context.Context, uploadID int64) (*BlockListCommit, error)
- func (s *Service) ShutdownReaderLeaseReleaser(ctx context.Context) error
- func (s *Service) StopAcceptingMerges()
- func (s *Service) UploadBlock(ctx context.Context, uploadID int64, blockID string, stream io.Reader) error
- func (s *Service) UploadPart(ctx context.Context, uploadID int64, stream io.Reader) error
- func (s *Service) WaitForMerges(ctx context.Context) error
Constants ¶
View Source
const MaxBlockListEntries = storage.MaxIndexedObjects
MaxBlockListEntries is the Azure block blob protocol limit.
Variables ¶
View Source
var ( ErrNoWriteScope = errors.New("no scope with write permission found") ErrUploadAlreadyExists = errors.New("upload already exists") ErrUploadNotFound = errors.New("upload not found") ErrNoPartsUploaded = errors.New("no parts have been uploaded") ErrPartCountMismatch = errors.New("uploaded part count does not match actual part count in storage") ErrBlockListTooLarge = errors.New("block list exceeds 50000 entries") ErrCacheNotFound = errors.New("cache not found") )
View Source
var ErrRangeNotSatisfiable = errors.New("requested byte range is not satisfiable")
Functions ¶
func ReadScopesByPermission ¶
func ReadScopesByPermission(scope auth.CacheScope) []string
func WriteScope ¶
func WriteScope(scope auth.CacheScope) (string, bool)
Types ¶
type BlockListCommit ¶ added in v1.1.1
type BlockListCommit struct {
// contains filtered or unexported fields
}
BlockListCommit is an upload-scoped capability prepared before the block list request body is parsed. Its upload snapshot is intentionally opaque to callers.
type ByteRange ¶ added in v1.1.2
type ByteRange struct {
// contains filtered or unexported fields
}
ByteRange is a parsed, representation-independent byte range. Constructors keep HTTP syntax out of the cache package while preserving the distinction between closed, open-ended, and suffix ranges until the total size is known.
func ClosedByteRange ¶ added in v1.1.2
func OpenEndedByteRange ¶ added in v1.1.2
func SuffixByteRange ¶ added in v1.1.2
type CapacityTrigger ¶ added in v1.1.1
type CapacityTrigger interface {
Trigger()
}
type CreateUploadResult ¶
type CreateUploadResult struct {
UploadID int64
}
type DownloadError ¶ added in v1.1.1
type DownloadError struct {
Err error
CacheEntryID string
StorageLocationID string
Representation string
}
func (*DownloadError) Error ¶ added in v1.1.1
func (e *DownloadError) Error() string
func (*DownloadError) Unwrap ¶ added in v1.1.1
func (e *DownloadError) Unwrap() error
type DownloadMetadata ¶ added in v1.1.2
type DownloadRange ¶ added in v1.1.2
type DownloadStream ¶ added in v1.1.1
type DownloadStream struct {
io.ReadCloser
CacheEntryID string
StorageLocationID string
Representation string
ContentLength int64
TotalLength int64
Range *DownloadRange
}
type MatchResult ¶
type MatchResult struct {
CacheEntry *ent.CacheEntry
DownloadURL string
}
type Options ¶
type Options struct {
DB *ent.Client
Storage storage.Adapter
EnableDirectDownloads bool
MergeConcurrency int
Lifecycle *storagelifecycle.Service
Logger *zerolog.Logger
Capacity CapacityTrigger
Now func() time.Time
UploadHeartbeatInterval time.Duration
PartIndexDiscoveryTimeout time.Duration
// PartIndexCacheBytes bounds immutable multipart boundary indexes by
// charged bytes. Non-positive values use the 64 MiB default.
PartIndexCacheBytes int64
}
type RangeNotSatisfiableError ¶ added in v1.1.2
type RangeNotSatisfiableError struct {
SizeBytes int64
}
func (*RangeNotSatisfiableError) Error ¶ added in v1.1.2
func (e *RangeNotSatisfiableError) Error() string
func (*RangeNotSatisfiableError) Unwrap ¶ added in v1.1.2
func (e *RangeNotSatisfiableError) Unwrap() error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func (*Service) CommitBlockList ¶
func (*Service) CompleteUpload ¶
func (*Service) CreateUpload ¶
func (s *Service) CreateUpload(ctx context.Context, key, version string, scope auth.CacheScope) (*CreateUploadResult, error)
func (*Service) DownloadMetadata ¶ added in v1.1.2
func (*Service) DownloadRanged ¶ added in v1.1.2
func (*Service) GetCacheEntryWithDownloadURL ¶
func (*Service) MatchCacheEntry ¶
func (s *Service) MatchCacheEntry(ctx context.Context, keys []string, version string, scope auth.CacheScope) (*ent.CacheEntry, error)
func (*Service) PrepareBlockListCommit ¶ added in v1.1.1
func (*Service) ShutdownReaderLeaseReleaser ¶ added in v1.1.2
ShutdownReaderLeaseReleaser drains and stops the worker started by the first lease release. Call it before closing the database; tests that close download streams should register the same cleanup when goroutine leak checks are used.
func (*Service) StopAcceptingMerges ¶
func (s *Service) StopAcceptingMerges()
func (*Service) UploadBlock ¶
func (*Service) UploadPart ¶
Click to show internal directories.
Click to hide internal directories.