Documentation
¶
Index ¶
- Constants
- Variables
- func NewStore(ctx context.Context, cachedVirtualClient, cachedHostClient client.Client, ...) (synccontext.MappingsStore, error)
- func NewStoreWithVerifyMapping(ctx context.Context, cachedVirtualClient, cachedHostClient client.Client, ...) (synccontext.MappingsStore, error)
- type Backend
- type BackendWatchEvent
- type BackendWatchEventType
- type BackendWatchResponse
- type Mapping
- type Store
- func (s *Store) AddReference(ctx context.Context, nameMapping, belongsTo synccontext.NameMapping) error
- func (s *Store) AddReferenceAndSave(ctx context.Context, nameMapping, belongsTo synccontext.NameMapping) error
- func (s *Store) DeleteMapping(ctx context.Context, nameMapping synccontext.NameMapping) error
- func (s *Store) DeleteReference(ctx context.Context, nameMapping, belongsTo synccontext.NameMapping) error
- func (s *Store) DeleteReferenceAndSave(ctx context.Context, nameMapping, belongsTo synccontext.NameMapping) error
- func (s *Store) HasHostObject(ctx context.Context, pObj synccontext.Object) bool
- func (s *Store) HasVirtualObject(ctx context.Context, vObj synccontext.Object) bool
- func (s *Store) HostToVirtualName(_ context.Context, pObj synccontext.Object) (types.NamespacedName, bool)
- func (s *Store) ReferencesTo(ctx context.Context, vObj synccontext.Object) []synccontext.NameMapping
- func (s *Store) SaveMapping(ctx context.Context, nameMapping synccontext.NameMapping) error
- func (s *Store) StartGarbageCollection(ctx context.Context)
- func (s *Store) VirtualToHostName(_ context.Context, vObj synccontext.Object) (types.NamespacedName, bool)
- func (s *Store) Watch(gvk schema.GroupVersionKind, addQueueFn synccontext.AddQueueFunc) source.Source
- type VerifyMapping
Constants ¶
View Source
const (
GarbageCollectionInterval = 3 * time.Minute
GarbageCollectionTimeout = 15 * time.Second
)
Variables ¶
View Source
var MappingsPrefix = "/vcluster/mappings/"
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
}
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)
type VerifyMapping ¶
type VerifyMapping func(mapping synccontext.NameMapping) bool
Source Files
¶
Click to show internal directories.
Click to hide internal directories.