store

package
v0.21.0-beta.7 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GarbageCollectionInterval = 3 * time.Minute
	GarbageCollectionTimeout  = 15 * time.Second
)

Variables

This section is empty.

Functions

func NewStore

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

func NewStoreWithVerifyMapping

func NewStoreWithVerifyMapping(ctx context.Context, cachedVirtualClient, cachedHostClient client.Client, backend Backend, verifyMapping VerifyMapping) (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 {
	Mapping *Mapping
	Type    BackendWatchEventType
}

type BackendWatchEventType

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

type BackendWatchResponse

type BackendWatchResponse struct {
	Err    error
	Events []*BackendWatchEvent
}

type Mapping

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

	Sender string `json:"sender,omitempty"`

	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) AddReference

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

func (*Store) AddReferenceAndSave

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

func (*Store) DeleteMapping

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

func (*Store) DeleteReference

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

func (*Store) DeleteReferenceAndSave

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

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) 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

type VerifyMapping

type VerifyMapping func(mapping synccontext.NameMapping) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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