Documentation ¶
Index ¶
- Variables
- func EtcdHealthCheck(data []byte) error
- func New(c *clientv3.Client, codec runtime.Codec, newFunc func() runtime.Object, ...) storage.Interface
- func StartCompactor(ctx context.Context, client *clientv3.Client, compactInterval time.Duration)
- func TestOnlySetFatalOnDecodeError(b bool)
- type APIObjectVersioner
- func (a APIObjectVersioner) CompareResourceVersion(lhs, rhs runtime.Object) int
- func (a APIObjectVersioner) ObjectResourceVersion(obj runtime.Object) (uint64, error)
- func (a APIObjectVersioner) ParseResourceVersion(resourceVersion string) (uint64, error)
- func (a APIObjectVersioner) PrepareObjectForStorage(obj runtime.Object) error
- func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint64, nextKey string, count *int64) error
- func (a APIObjectVersioner) UpdateObject(obj runtime.Object, resourceVersion uint64) error
- type LeaseManagerConfig
Constants ¶
This section is empty.
Variables ¶
var Versioner storage.Versioner = APIObjectVersioner{}
Versioner implements Versioner
Functions ¶
func EtcdHealthCheck ¶
EtcdHealthCheck decodes data returned from etcd /healthz handler.
func New ¶
func New(c *clientv3.Client, codec runtime.Codec, newFunc func() runtime.Object, prefix string, groupResource schema.GroupResource, transformer value.Transformer, pagingEnabled bool, leaseManagerConfig LeaseManagerConfig) storage.Interface
New returns an etcd3 implementation of storage.Interface.
func StartCompactor ¶
StartCompactor starts a compactor in the background to compact old version of keys that's not needed. By default, we save the most recent 10 minutes data and compact versions > 10minutes ago. It should be enough for slow watchers and to tolerate burst. TODO: We might keep a longer history (12h) in the future once storage API can take advantage of past version of keys.
func TestOnlySetFatalOnDecodeError ¶
func TestOnlySetFatalOnDecodeError(b bool)
TestOnlySetFatalOnDecodeError should only be used for cases where decode errors are expected and need to be tested. e.g. conversion webhooks.
Types ¶
type APIObjectVersioner ¶
type APIObjectVersioner struct{}
APIObjectVersioner implements versioning and extracting etcd node information for objects that have an embedded ObjectMeta or ListMeta field.
func (APIObjectVersioner) CompareResourceVersion ¶
func (a APIObjectVersioner) CompareResourceVersion(lhs, rhs runtime.Object) int
CompareResourceVersion compares etcd resource versions. Outside this API they are all strings, but etcd resource versions are special, they're actually ints, so we can easily compare them.
func (APIObjectVersioner) ObjectResourceVersion ¶
func (a APIObjectVersioner) ObjectResourceVersion(obj runtime.Object) (uint64, error)
ObjectResourceVersion implements Versioner
func (APIObjectVersioner) ParseResourceVersion ¶
func (a APIObjectVersioner) ParseResourceVersion(resourceVersion string) (uint64, error)
ParseResourceVersion takes a resource version argument and converts it to the etcd version. For watch we should pass to helper.Watch(). Because resourceVersion is an opaque value, the default watch behavior for non-zero watch is to watch the next value (if you pass "1", you will see updates from "2" onwards).
func (APIObjectVersioner) PrepareObjectForStorage ¶
func (a APIObjectVersioner) PrepareObjectForStorage(obj runtime.Object) error
PrepareObjectForStorage clears resource version and self link prior to writing to etcd.
func (APIObjectVersioner) UpdateList ¶
func (a APIObjectVersioner) UpdateList(obj runtime.Object, resourceVersion uint64, nextKey string, count *int64) error
UpdateList implements Versioner
func (APIObjectVersioner) UpdateObject ¶
func (a APIObjectVersioner) UpdateObject(obj runtime.Object, resourceVersion uint64) error
UpdateObject implements Versioner
type LeaseManagerConfig ¶
type LeaseManagerConfig struct { // ReuseDurationSeconds specifies time in seconds that each lease is reused ReuseDurationSeconds int64 // MaxObjectCount specifies how many objects that a lease can attach MaxObjectCount int64 }
LeaseManagerConfig is configuration for creating a lease manager.
func NewDefaultLeaseManagerConfig ¶
func NewDefaultLeaseManagerConfig() LeaseManagerConfig
NewDefaultLeaseManagerConfig creates a LeaseManagerConfig with default values