store

package
v0.21.0-alpha.4 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const GarbageCollectionInterval = time.Minute * 3

Variables

This section is empty.

Functions

func NewStore

func NewStore(ctx context.Context, cachedVirtualClient, cachedHostClient client.Client, backend Backend) (synccontext.MappingsStore, error)

Types

type Backend

type Backend interface {
	// List retrieves all saved mappings
	List(ctx context.Context) ([]*Mapping, error)

	// Watch lists and watches for new mappings
	Watch(ctx context.Context) <-chan BackendWatchResponse

	// Save saves the given mapping
	Save(ctx context.Context, mapping *Mapping) error

	// Delete removes the given mapping
	Delete(ctx context.Context, mapping *Mapping) error
}

func NewEtcdBackend

func NewEtcdBackend(etcdClient etcd.Client) Backend

func NewMemoryBackend

func NewMemoryBackend(mappings ...*Mapping) Backend

type BackendWatchEvent

type BackendWatchEvent struct {
	Type    BackendWatchEventType
	Mapping *Mapping
}

type BackendWatchEventType

type BackendWatchEventType string
const (
	BackendWatchEventTypeUpdate BackendWatchEventType = "Update"
	BackendWatchEventTypeDelete BackendWatchEventType = "Delete"
)

type BackendWatchResponse

type BackendWatchResponse struct {
	Events []*BackendWatchEvent

	Err error
}

type Mapping

type Mapping struct {
	synccontext.NameMapping `json:",inline"`

	References []synccontext.NameMapping `json:"references,omitempty"`
	// contains filtered or unexported fields
}

func (Mapping) String

func (m Mapping) String() string

type Store

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

func (*Store) HasHostObject

func (s *Store) HasHostObject(ctx context.Context, pObj synccontext.Object) bool

func (*Store) HasVirtualObject

func (s *Store) HasVirtualObject(ctx context.Context, vObj synccontext.Object) bool

func (*Store) HostToVirtualName

func (s *Store) HostToVirtualName(_ context.Context, pObj synccontext.Object) (types.NamespacedName, bool)

func (*Store) RecordAndSaveReference

func (s *Store) RecordAndSaveReference(ctx context.Context, nameMapping, belongsTo synccontext.NameMapping) error

func (*Store) RecordReference

func (s *Store) RecordReference(ctx context.Context, nameMapping, belongsTo synccontext.NameMapping) error

func (*Store) ReferencesTo

func (s *Store) ReferencesTo(ctx context.Context, vObj synccontext.Object) []synccontext.NameMapping

func (*Store) SaveMapping

func (s *Store) SaveMapping(ctx context.Context, nameMapping synccontext.NameMapping) error

func (*Store) StartGarbageCollection

func (s *Store) StartGarbageCollection(ctx context.Context)

func (*Store) VirtualToHostName

func (s *Store) VirtualToHostName(_ context.Context, vObj synccontext.Object) (types.NamespacedName, bool)

func (*Store) Watch

Jump to

Keyboard shortcuts

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