Documentation ¶
Overview ¶
Package core exposes core objects used by datamon
Index ¶
- Constants
- Variables
- func CreateRepo(repo model.RepoDescriptor, store storage.Store) error
- func DeleteBundle(repo string, store storage.Store, bundleID string) error
- func DeleteEntriesFromRepo(repo string, store storage.Store, toDelete []string) error
- func DeleteLabel(repo string, store storage.Store, name string) error
- func DeleteRepo(repo string, store storage.Store) error
- func DownloadMetadata(ctx context.Context, bundle *Bundle) error
- func GetLatestBundle(repo string, store storage.Store) (string, error)
- func GetRepo(repo string, store storage.Store) (*model.RepoDescriptor, error)
- func GetRepoDescriptorByRepoName(store storage.Store, repoName string) (model.RepoDescriptor, error)
- func ListBundles(repo string, store storage.Store, opts ...ListOption) (model.BundleDescriptors, error)
- func ListBundlesApply(repo string, store storage.Store, apply ApplyBundleFunc, opts ...ListOption) error
- func ListLabels(repo string, store storage.Store, prefix string, opts ...ListOption) ([]model.LabelDescriptor, error)
- func ListLabelsApply(repo string, store storage.Store, prefix string, apply ApplyLabelFunc, ...) error
- func ListRepos(store storage.Store, opts ...ListOption) ([]model.RepoDescriptor, error)
- func ListReposApply(store storage.Store, apply ApplyRepoFunc, opts ...ListOption) error
- func ListReposPaginated(store storage.Store, token string) ([]model.RepoDescriptor, error)
- func NewBDescriptor(descriptorOps ...BundleDescriptorOption) *model.BundleDescriptor
- func NewLabelDescriptor(descriptorOps ...LabelDescriptorOption) *model.LabelDescriptor
- func PopulateFiles(ctx context.Context, bundle *Bundle) error
- func Publish(ctx context.Context, bundle *Bundle) error
- func PublishFile(ctx context.Context, bundle *Bundle, file string) error
- func PublishMetadata(ctx context.Context, bundle *Bundle) error
- func PublishSelectBundleEntries(ctx context.Context, bundle *Bundle, ...) error
- func RepoExists(repo string, store storage.Store) error
- func Update(ctx context.Context, bundleSrc *Bundle, bundleDest *Bundle) error
- func Upload(ctx context.Context, bundle *Bundle) error
- func UploadSpecificKeys(ctx context.Context, bundle *Bundle, getKeys func() ([]string, error)) error
- type ApplyBundleFunc
- type ApplyLabelFunc
- type ApplyRepoFunc
- type Bundle
- type BundleDescriptorOption
- type BundleDiff
- type BundleOption
- func BlobStore(store storage.Store) BundleOption
- func BundleID(bID string) BundleOption
- func ConcurrentFileDownloads(concurrentFileDownloads int) BundleOption
- func ConcurrentFileUploads(concurrentFileUploads int) BundleOption
- func ConcurrentFilelistDownloads(concurrentFilelistDownloads int) BundleOption
- func ConsumableStore(store storage.Store) BundleOption
- func Logger(l *zap.Logger) BundleOption
- func MetaStore(store storage.Store) BundleOption
- func Repo(r string) BundleOption
- func SkipMissing(s bool) BundleOption
- func Streaming(s bool) BundleOption
- type DiffEntry
- type DiffEntryType
- type Label
- type LabelDescriptorOption
- type LabelOption
- type ListOption
- type MutableFS
- type ReadOnlyFS
- type Settings
Constants ¶
const ( DiffEntryTypeAdd = iota DiffEntryTypeDel DiffEntryTypeDif )
Variables ¶
var MemProfDir string
Functions ¶
func CreateRepo ¶
func CreateRepo(repo model.RepoDescriptor, store storage.Store) error
func DeleteBundle ¶ added in v1.1.0
DeleteBundle removes a single bundle from a repo
func DeleteEntriesFromRepo ¶ added in v1.1.0
DeleteEntriesFromRepo remove a list of file entries from all bundles in a repo
func DeleteLabel ¶ added in v1.1.0
DeleteLabel removes a single label from a repo
func DeleteRepo ¶ added in v1.1.0
DeleteRepo removes a repository from metadata
func DownloadMetadata ¶
DownloadMetadata from the archive to main memory
func GetLatestBundle ¶
GetLatestBundle returns the latest bundle descriptor from a repo
func GetRepoDescriptorByRepoName ¶
func GetRepoDescriptorByRepoName(store storage.Store, repoName string) (model.RepoDescriptor, error)
GetRepoDescriptorByRepoName returns the descriptor of a named repo
func ListBundles ¶
func ListBundles(repo string, store storage.Store, opts ...ListOption) (model.BundleDescriptors, error)
ListBundles returns a list of bundle descriptors from a repo. It collects all bundles until completion.
NOTE: this func could become deprecated. At this moment, however, it is used by pkg/web.
func ListBundlesApply ¶
func ListBundlesApply(repo string, store storage.Store, apply ApplyBundleFunc, opts ...ListOption) error
ListBundlesApply applies some function to the retrieved bundles, in lexicographic order of keys.
The execution of the applied function does not block background retrieval of more keys and bundle descriptors.
Example usage: printing bundle descriptors as they come
err := core.ListBundlesApply(repo, store, func(bundle model.BundleDescriptor) error { fmt.Fprintf(os.Stderr, "%v\n", bundle) return nil })
func ListLabels ¶
func ListLabels(repo string, store storage.Store, prefix string, opts ...ListOption) ([]model.LabelDescriptor, error)
ListLabels returns all labels from a repo
func ListLabelsApply ¶
func ListLabelsApply(repo string, store storage.Store, prefix string, apply ApplyLabelFunc, opts ...ListOption) error
ListLabelsApply applies some function to the retrieved labels, in lexicographic order of keys.
func ListRepos ¶
func ListRepos(store storage.Store, opts ...ListOption) ([]model.RepoDescriptor, error)
ListRepos returns all repos from a store
func ListReposApply ¶
func ListReposApply(store storage.Store, apply ApplyRepoFunc, opts ...ListOption) error
ListReposApply applies some function to the retrieved repos, in lexicographic order of keys.
func ListReposPaginated ¶
ListReposPaginated is at this moment only used by the CSI package. Question: shall we deprecate this?
func NewBDescriptor ¶
func NewBDescriptor(descriptorOps ...BundleDescriptorOption) *model.BundleDescriptor
func NewLabelDescriptor ¶
func NewLabelDescriptor(descriptorOps ...LabelDescriptorOption) *model.LabelDescriptor
func PublishMetadata ¶
PublishMetadata from the archive to the consumable store
Types ¶
type ApplyBundleFunc ¶
type ApplyBundleFunc func(model.BundleDescriptor) error
ApplyBundleFunc is a function to be applied on a bundle
type ApplyLabelFunc ¶
type ApplyLabelFunc func(model.LabelDescriptor) error
ApplyLabelFunc is a function to be applied on a label
type ApplyRepoFunc ¶
type ApplyRepoFunc func(model.RepoDescriptor) error
ApplyRepoFunc is a function to be applied on a repo
type Bundle ¶
type Bundle struct { RepoID string BundleID string MetaStore storage.Store ConsumableStore storage.Store BlobStore storage.Store BundleDescriptor model.BundleDescriptor BundleEntries []model.BundleEntry Streamed bool SkipOnError bool // When uploading files // contains filtered or unexported fields }
Bundle represents the bundle in its archived state
func New ¶
func New(bd *model.BundleDescriptor, bundleOps ...BundleOption) *Bundle
func (*Bundle) GetBundleEntries ¶
func (b *Bundle) GetBundleEntries() []model.BundleEntry
func (*Bundle) InitializeBundleID ¶
InitializeBundleID create and set a new bundle ID
type BundleDescriptorOption ¶
type BundleDescriptorOption func(descriptor *model.BundleDescriptor)
func Contributor ¶
func Contributor(c model.Contributor) BundleDescriptorOption
func Contributors ¶
func Contributors(c []model.Contributor) BundleDescriptorOption
func Message ¶
func Message(m string) BundleDescriptorOption
func Parents ¶
func Parents(p []string) BundleDescriptorOption
type BundleDiff ¶
type BundleDiff struct {
Entries []DiffEntry
}
type BundleOption ¶
type BundleOption func(*Bundle)
func BlobStore ¶
func BlobStore(store storage.Store) BundleOption
func BundleID ¶
func BundleID(bID string) BundleOption
func ConcurrentFileDownloads ¶
func ConcurrentFileDownloads(concurrentFileDownloads int) BundleOption
func ConcurrentFileUploads ¶
func ConcurrentFileUploads(concurrentFileUploads int) BundleOption
func ConcurrentFilelistDownloads ¶
func ConcurrentFilelistDownloads(concurrentFilelistDownloads int) BundleOption
func ConsumableStore ¶
func ConsumableStore(store storage.Store) BundleOption
func Logger ¶
func Logger(l *zap.Logger) BundleOption
func MetaStore ¶
func MetaStore(store storage.Store) BundleOption
func Repo ¶
func Repo(r string) BundleOption
func SkipMissing ¶
func SkipMissing(s bool) BundleOption
func Streaming ¶
func Streaming(s bool) BundleOption
type DiffEntry ¶
type DiffEntry struct { Type DiffEntryType // could use a method rather than storing Name in order to curb memory use Name string Existing model.BundleEntry Additional model.BundleEntry }
type DiffEntryType ¶
type DiffEntryType uint
func (DiffEntryType) String ¶
func (det DiffEntryType) String() string
type Label ¶
type Label struct {
Descriptor model.LabelDescriptor
}
func NewLabel ¶
func NewLabel(ld *model.LabelDescriptor, labelOps ...LabelOption) *Label
func (*Label) DownloadDescriptor ¶
type LabelDescriptorOption ¶
type LabelDescriptorOption func(descriptor *model.LabelDescriptor)
func LabelContributor ¶
func LabelContributor(c model.Contributor) LabelDescriptorOption
func LabelContributors ¶
func LabelContributors(c []model.Contributor) LabelDescriptorOption
type LabelOption ¶
type LabelOption func(*Label)
func LabelName ¶
func LabelName(name string) LabelOption
type ListOption ¶
type ListOption func(*Settings)
ListOption sets options for listing core objects
func BatchSize ¶
func BatchSize(batchSize int) ListOption
BatchSize sets the batch window to fetch core objects. It defaults to defaultBatchSize
func ConcurrentList ¶
func ConcurrentList(concurrentList int) ListOption
ConcurrentList sets the max level of concurrency to retrieve core objects. It defaults to 2 x #cpus.
func WithDoneChan ¶
func WithDoneChan(done chan struct{}) ListOption
WithDoneChan sets a signaling channel controlled by the caller to interrupt ongoing goroutines
type MutableFS ¶
type MutableFS struct {
// contains filtered or unexported fields
}
ReadOnlyFS is the virtual filesystem created on top of a bundle.
func NewMutableFS ¶
NewMutableFS creates a new instance of the datamon filesystem.
func (*MutableFS) MountMutable ¶
type ReadOnlyFS ¶
type ReadOnlyFS struct {
// contains filtered or unexported fields
}
ReadOnlyFS is the virtual filesystem created on top of a bundle.
func NewReadOnlyFS ¶
func NewReadOnlyFS(bundle *Bundle, l *zap.Logger) (*ReadOnlyFS, error)
NewReadOnlyFS creates a new instance of the datamon filesystem.
func (*ReadOnlyFS) MountReadOnly ¶
func (dfs *ReadOnlyFS) MountReadOnly(path string) error
func (*ReadOnlyFS) Unmount ¶
func (dfs *ReadOnlyFS) Unmount(path string) error