Documentation ¶
Overview ¶
Package manifest implements support for managing JSON-based manifests in repository.
Index ¶
- Constants
- Variables
- type EntryMetadata
- type ID
- type Manager
- func (m *Manager) Compact(ctx context.Context) error
- func (m *Manager) Delete(ctx context.Context, id ID) error
- func (m *Manager) Find(ctx context.Context, labels map[string]string) ([]*EntryMetadata, error)
- func (m *Manager) Flush(ctx context.Context) error
- func (m *Manager) Get(ctx context.Context, id ID, data interface{}) (*EntryMetadata, error)
- func (m *Manager) GetMetadata(ctx context.Context, id ID) (*EntryMetadata, error)
- func (m *Manager) Put(ctx context.Context, labels map[string]string, payload interface{}) (ID, error)
- type ManagerOptions
Constants ¶
const (
ContentPrefix = "m"
)
ContentPrefix is the prefix of the content id for manifests.
const TypeLabelKey = "type"
TypeLabelKey is the label key for manifest type.
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is returned when the metadata item is not found.
Functions ¶
This section is empty.
Types ¶
type EntryMetadata ¶
type EntryMetadata struct { ID ID `json:"id"` Length int `json:"length"` Labels map[string]string `json:"labels"` ModTime time.Time `json:"mtime"` }
EntryMetadata contains metadata about manifest item. Each manifest item has one or more labels Including required "type" label.
func DedupeEntryMetadataByLabel ¶ added in v0.8.0
func DedupeEntryMetadataByLabel(entries []*EntryMetadata, label string) []*EntryMetadata
DedupeEntryMetadataByLabel deduplicates EntryMetadata in a provided slice by picking the latest one for a given set of label.
type ID ¶
type ID string
ID is a unique identifier of a single manifest.
func PickLatestID ¶ added in v0.8.0
func PickLatestID(entries []*EntryMetadata) ID
PickLatestID picks the ID of latest EntryMetadata in a given slice.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager organizes JSON manifests of various kinds, including snapshot manifests.
func NewManager ¶
func NewManager(ctx context.Context, b contentManager, options ManagerOptions) (*Manager, error)
NewManager returns new manifest manager for the provided content manager.
func (*Manager) Find ¶
Find returns the list of EntryMetadata for manifest entries matching all provided labels.
func (*Manager) Get ¶
Get retrieves the contents of the provided manifest item by deserializing it as JSON to provided object. If the manifest is not found, returns ErrNotFound.
func (*Manager) GetMetadata ¶
GetMetadata returns metadata about provided manifest item or ErrNotFound if the item can't be found.
type ManagerOptions ¶ added in v0.6.0
ManagerOptions are optional parameters for Manager creation.