catalog

package
v0.1.0-rc Latest Latest
Warning

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

Go to latest
Published: May 7, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatKey

func FormatKey(filePath string) string

FormatKey ...

func GroupByStore

func GroupByStore(files map[string]File) map[string]map[string]File

GroupByStore ...

func GroupByStoreSlice

func GroupByStoreSlice(files map[string]File) map[string][]File

GroupByStoreSlice ...

func Save

func Save(file string, c Catalog) error

Save ...

Types

type ByPath

type ByPath []File

func (ByPath) Len

func (f ByPath) Len() int

func (ByPath) Less

func (f ByPath) Less(i, j int) bool

func (ByPath) Swap

func (f ByPath) Swap(i, j int)

type Catalog

type Catalog struct {
	Version string `yaml:"version"`

	Context string `yaml:"context"`

	Files map[string]File `yaml:"files"`
}

Catalog is reference file for the remotely stored configuration files.

func Init

func Init(context, catalogFile string, dep InitDep) (Catalog, error)

Init creates a new or loads an existing catalog file.

func Read

func Read(catalogFile string) (Catalog, error)

Read loads an existing catalog file.

func (*Catalog) AddFile

func (c *Catalog) AddFile(filePath, store string, tags []string)

AddFile ...

func (*Catalog) Filter

func (c *Catalog) Filter(filter Filter) map[string]File

Filter ...

func (*Catalog) LookupStore

func (c *Catalog) LookupStore(filePath string) string

func (*Catalog) MergeResults

func (c *Catalog) MergeResults(files []store.File)

MergeResults ...

type File

type File struct {
	// Path is the local location.
	Path string `yaml:"path"`

	// Type is the local file type. (e.g. env,json,txt,etc.)
	Type string `yaml:"type,omitempty"`

	// Store is the remote location.
	Store string `yaml:"store,omitempty"`

	// Options allow stores to persist user preferences locally.
	Options map[string]string `yaml:"opt,omitempty" mapstructure:"opt"`

	// Keys allows stores to track which fields are stored remotely.
	Keys []string `yaml:"keys,omitempty"`

	// Tags allow files to be grouped; so, they can be listed, purged,
	// and restored in a single command.
	Tags []string `yaml:"tags,omitempty"`

	// Clean deletes the local files after changes have been pushed
	// to the remote store.
	Clean bool `yaml:"clean,omitempty"`
}

File represents a configuration file that is remotely stored. All fields in this model should be safe to be shared and checked into source control.

func (*File) AddTag

func (f *File) AddTag(tag string)

AddTag ...

func (*File) CatalogKey

func (f *File) CatalogKey() string

CatalogKey ...

func (*File) ClearState

func (f *File) ClearState(context string) error

ClearState ...

func (*File) LookupState

func (f *File) LookupState(context string) (State, error)

LookupState ...

func (*File) Matches

func (f *File) Matches(filter Filter) bool

Matches ...

func (*File) RecordState

func (f *File) RecordState(context string) error

RecordState ...

func (*File) RemoveTag

func (f *File) RemoveTag(tag string)

RemoveTag ...

func (File) ToStoreModel

func (f File) ToStoreModel(context, key string, remote store.IStore, data []byte) (store.File, error)

ToStoreModel ...

type Filter

type Filter struct {
	Files []string
	Tags  []string

	Store string
}

Filter ...

func NewPullFilter

func NewPullFilter(files, tags []string, store string) Filter

NewPullFilter ...

func NewPushFilter

func NewPushFilter(files, tags []string, store string) Filter

NewPushFilter ...

func (Filter) Empty

func (f Filter) Empty() bool

Empty ...

func (Filter) Format

func (f Filter) Format(delimiter string) string

Format ...

type InitDep

type InitDep struct {
	Stderr io.Writer
}

InitDep ...

type State

type State struct {
	Synced time.Time
}

Jump to

Keyboard shortcuts

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