store

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2019 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JoinKeyPrefix

func JoinKeyPrefix(prefixes ...string) string

func KeyPrefixForAPIVersion

func KeyPrefixForAPIVersion(apiVersion string) string

func KeyPrefixForAPIVersionKind

func KeyPrefixForAPIVersionKind(apiVersion, kind string) string

func KeyPrefixForAPIVersionKindNamespace

func KeyPrefixForAPIVersionKindNamespace(apiVersion, kind, namespace string) string

func NewInstrumentedAsyncRevisionInterface

func NewInstrumentedAsyncRevisionInterface(r AsyncWriteRevisionInterface) *instrumentedAsyncRevisionInterface

func NewInstrumentedRevisionInterface

func NewInstrumentedRevisionInterface(r RevisionInterface) *instrumentedRevisionInterface

func NewInstrumentedRevisionPurger

func NewInstrumentedRevisionPurger(r RevisionPurger) *instrumentedRevisionPurger

func NewRevisionPurger

func NewRevisionPurger(s *RevisionStore) *revisionPurger

func ResourceKey

func ResourceKey(apiVersion, kind, namespace, name string) string

func RevisionKey

func RevisionKey(resourceKey string, revisionKey string) string

func StripMetadata

func StripMetadata(u *unstructured.Unstructured)

Types

type AsyncResponse

type AsyncResponse struct {
	Revision Revision
	Error    error
}

type AsyncWriteRevisionInterface

type AsyncWriteRevisionInterface interface {
	RevisionInterface
	AsyncCreate(context.Context, Revision) (<-chan AsyncResponse, error)
	AsyncUpdate(context.Context, Revision) (<-chan AsyncResponse, error)
	AsyncDelete(context.Context, Revision) (<-chan AsyncResponse, error)
}

type ConcreteRevision

type ConcreteRevision struct {
	// contains filtered or unexported fields
}

func (*ConcreteRevision) APIVersion

func (c *ConcreteRevision) APIVersion() string

func (*ConcreteRevision) Content

func (*ConcreteRevision) Deleted

func (c *ConcreteRevision) Deleted() bool

func (ConcreteRevision) Key

func (r ConcreteRevision) Key() string

func (*ConcreteRevision) Kind

func (c *ConcreteRevision) Kind() string

func (*ConcreteRevision) MarshalJSON

func (c *ConcreteRevision) MarshalJSON() ([]byte, error)

func (*ConcreteRevision) Name

func (c *ConcreteRevision) Name() string

func (*ConcreteRevision) Namespace

func (c *ConcreteRevision) Namespace() string

func (ConcreteRevision) ResourceKey

func (r ConcreteRevision) ResourceKey() string

func (*ConcreteRevision) ResourceVersion

func (c *ConcreteRevision) ResourceVersion() int

func (ConcreteRevision) RevisionKey

func (r ConcreteRevision) RevisionKey() string

func (*ConcreteRevision) RevisionTimestamp

func (c *ConcreteRevision) RevisionTimestamp() time.Time

func (*ConcreteRevision) SetDeleted

func (c *ConcreteRevision) SetDeleted(deleted bool)

func (*ConcreteRevision) String

func (c *ConcreteRevision) String() string

func (*ConcreteRevision) TypeMeta

func (c *ConcreteRevision) TypeMeta() metav1.TypeMeta

type InMemoryRevisionGetter

type InMemoryRevisionGetter struct {
	// contains filtered or unexported fields
}

func NewInMemoryGetter

func NewInMemoryGetter() *InMemoryRevisionGetter

func (*InMemoryRevisionGetter) Backend

func (s *InMemoryRevisionGetter) Backend() string

func (*InMemoryRevisionGetter) PurgeRevision

func (s *InMemoryRevisionGetter) PurgeRevision(ctx context.Context, rev Revision) error

func (*InMemoryRevisionGetter) PurgeRevisions

func (s *InMemoryRevisionGetter) PurgeRevisions(ctx context.Context, revs RevisionList) (RevisionList, error)

func (*InMemoryRevisionGetter) Revisions

func (s *InMemoryRevisionGetter) Revisions(namespace string) RevisionInterface

func (*InMemoryRevisionGetter) State

TODO support label selectors for cached backend? not really needed right now

type LazyLoadingRevision

type LazyLoadingRevision struct {
	// contains filtered or unexported fields
}

func ParseLazyLoadingRevision

func ParseLazyLoadingRevision(ctx context.Context, s Storer, path string) (*LazyLoadingRevision, error)

func (*LazyLoadingRevision) APIVersion

func (l *LazyLoadingRevision) APIVersion() string

func (*LazyLoadingRevision) Content

func (*LazyLoadingRevision) Deleted

func (l *LazyLoadingRevision) Deleted() bool

func (LazyLoadingRevision) Key

func (r LazyLoadingRevision) Key() string

func (*LazyLoadingRevision) Kind

func (l *LazyLoadingRevision) Kind() string

func (*LazyLoadingRevision) MarshalJSON

func (l *LazyLoadingRevision) MarshalJSON() ([]byte, error)

func (*LazyLoadingRevision) Name

func (l *LazyLoadingRevision) Name() string

func (*LazyLoadingRevision) Namespace

func (l *LazyLoadingRevision) Namespace() string

func (LazyLoadingRevision) ResourceKey

func (r LazyLoadingRevision) ResourceKey() string

func (*LazyLoadingRevision) ResourceVersion

func (l *LazyLoadingRevision) ResourceVersion() int

func (LazyLoadingRevision) RevisionKey

func (r LazyLoadingRevision) RevisionKey() string

func (*LazyLoadingRevision) RevisionTimestamp

func (l *LazyLoadingRevision) RevisionTimestamp() time.Time

func (*LazyLoadingRevision) SetDeleted

func (l *LazyLoadingRevision) SetDeleted(deleted bool)

func (*LazyLoadingRevision) String

func (l *LazyLoadingRevision) String() string

func (*LazyLoadingRevision) TypeMeta

func (l *LazyLoadingRevision) TypeMeta() metav1.TypeMeta

type OptionFunc

type OptionFunc func(*RevisionStore)

func WithBackend

func WithBackend(backend backend.Backend) OptionFunc

func WithCache

func WithCache(shouldCache bool) OptionFunc

func WithConcurrentWrites

func WithConcurrentWrites(concurrentWrites int) OptionFunc

func WithConfigger

func WithConfigger(configger config.Configger) OptionFunc

func WithDeleteUntracked

func WithDeleteUntracked(deleteUntracked bool) OptionFunc

func WithEncrypter

func WithEncrypter(e crypt.Encrypter) OptionFunc

type PurgingRevisionGetter

type PurgingRevisionGetter interface {
	RevisionGetter
	RevisionPurger
}

type ReadWriteStore

type ReadWriteStore struct {
	Storer
	// contains filtered or unexported fields
}

func (*ReadWriteStore) Backend

func (s *ReadWriteStore) Backend() string

func (*ReadWriteStore) PurgeRevision

func (s *ReadWriteStore) PurgeRevision(ctx context.Context, rev Revision) error

func (*ReadWriteStore) PurgeRevisions

func (s *ReadWriteStore) PurgeRevisions(ctx context.Context, revs RevisionList) (RevisionList, error)

func (*ReadWriteStore) Revisions

func (s *ReadWriteStore) Revisions(namespace string) RevisionInterface

func (*ReadWriteStore) State

func (s *ReadWriteStore) State(ctx context.Context, o StateOptions) (State, error)

func (*ReadWriteStore) Sync

type Revision

type Revision interface {
	json.Marshaler
	fmt.Stringer
	Content() (*unstructured.Unstructured, error)
	Namespace() string
	Name() string
	ResourceVersion() int
	RevisionTimestamp() time.Time
	APIVersion() string
	Kind() string
	RevisionKey() string
	ResourceKey() string
	Key() string
	SetDeleted(bool)
	Deleted() bool
	TypeMeta() metav1.TypeMeta
}

type RevisionClient

type RevisionClient interface {
	PurgingRevisionGetter
	Stater
}

type RevisionGetter

type RevisionGetter interface {
	Revisions(namespace string) RevisionInterface
}

type RevisionList

type RevisionList []Revision

func (RevisionList) Cut

func (revs RevisionList) Cut(i, j int) RevisionList

func (RevisionList) Len

func (revs RevisionList) Len() int

func (RevisionList) Less

func (revs RevisionList) Less(x, y int) bool

func (RevisionList) MarshalJSONWithContent

func (revs RevisionList) MarshalJSONWithContent(prefix, indent string) ([]byte, error)

func (RevisionList) String

func (revs RevisionList) String() string

func (RevisionList) Swap

func (revs RevisionList) Swap(x, y int)

type RevisionPurger

type RevisionPurger interface {
	PurgeRevision(context.Context, Revision) error
	PurgeRevisions(context.Context, RevisionList) (RevisionList, error)
}

type RevisionStore

type RevisionStore struct {
	config.Configger
	RevisionPurger
	// contains filtered or unexported fields
}

func (*RevisionStore) Backend

func (s *RevisionStore) Backend() string

func (*RevisionStore) Close

func (s *RevisionStore) Close(ctx context.Context) error

func (*RevisionStore) Revisions

func (s *RevisionStore) Revisions(namespace string) RevisionInterface

func (*RevisionStore) State

func (s *RevisionStore) State(ctx context.Context, o StateOptions) (State, error)

func (*RevisionStore) Sync

type State

type State map[string]RevisionList

func (State) MarshalJSONOnlyContent

func (s State) MarshalJSONOnlyContent(prefix, indent string) ([]byte, error)

func (State) MarshalJSONWithContent

func (s State) MarshalJSONWithContent(prefix, indent string) ([]byte, error)

type StateOptions

type StateOptions struct {
	metav1.TypeMeta
	LabelSelector *metav1.LabelSelector
	Time          time.Time
	Namespace     string
	AllNamespaces bool
	Name          string
	AllRevisions  bool
	OnlyDeleted   bool
}

type Stater

type Stater interface {
	State(context.Context, StateOptions) (State, error)
}

type Storer

type Storer interface {
	RevisionClient
	config.Configger
	// PurgeObject(tm metav1.TypeMeta, namespace, name string) error
	Sync(context.Context, handler.ResourceHandlers) (State, RevisionList, error)
	Close(context.Context) error
	Backend() string
}

func New

func New(ctx context.Context, opts ...OptionFunc) (Storer, error)

func NewFromEnv

func NewFromEnv(ctx context.Context) (Storer, error)

func NewReadWriteStorer

func NewReadWriteStorer(writer Storer, reader RevisionClient, concurrentWriteSemaphore *semaphore.Weighted) (Storer, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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