manifest

package
v0.3.0-rc3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2019 License: Apache-2.0 Imports: 12 Imported by: 13

Documentation

Overview

Package manifest implements support for managing JSON-based manifests in repository.

Index

Constants

This section is empty.

Variables

View Source
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
	Length  int
	Labels  map[string]string
	ModTime time.Time
}

EntryMetadata contains metadata about manifest item. Each manifest item has one or more labels Including required "type" label.

type ID

type ID string

ID is a unique identifier of a single manifest.

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) (*Manager, error)

NewManager returns new manifest manager for the provided content manager.

func (*Manager) Compact

func (m *Manager) Compact(ctx context.Context) error

Compact performs compaction of manifest contents.

func (*Manager) Delete

func (m *Manager) Delete(ctx context.Context, id ID) error

Delete marks the specified manifest ID for deletion.

func (*Manager) Find

func (m *Manager) Find(ctx context.Context, labels map[string]string) ([]*EntryMetadata, error)

Find returns the list of EntryMetadata for manifest entries matching all provided labels.

func (*Manager) Flush

func (m *Manager) Flush(ctx context.Context) error

Flush persists changes to manifest manager.

func (*Manager) Get

func (m *Manager) Get(ctx context.Context, id ID, data interface{}) error

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

func (m *Manager) GetMetadata(ctx context.Context, id ID) (*EntryMetadata, error)

GetMetadata returns metadata about provided manifest item or ErrNotFound if the item can't be found.

func (*Manager) GetRaw

func (m *Manager) GetRaw(ctx context.Context, id ID) ([]byte, error)

GetRaw returns raw contents of the provided manifest (JSON bytes) or ErrNotFound if not found.

func (*Manager) Put

func (m *Manager) Put(ctx context.Context, labels map[string]string, payload interface{}) (ID, error)

Put serializes the provided payload to JSON and persists it. Returns unique identifier that represents the manifest.

func (*Manager) Refresh

func (m *Manager) Refresh(ctx context.Context) error

Refresh updates the committed contents from the underlying storage.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL