package storage

import "k8s.io/kubernetes/pkg/registry/core/service/allocator/storage"

Index

Types

type Etcd

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

Etcd exposes a service.Allocator TODO: allow multiple allocations to be tried at once TODO: subdivide the keyspace to reduce conflicts TODO: investigate issuing a CAS without reading first

func NewEtcd

func NewEtcd(alloc allocator.Snapshottable, baseKey string, config *storagebackend.ConfigForResource) (*Etcd, error)

NewEtcd returns an allocator that is backed by Etcd and can manage persisting the snapshot state of allocation after each allocation is made.

func (*Etcd) Allocate

func (e *Etcd) Allocate(offset int) (bool, error)

Allocate attempts to allocate the item.

func (*Etcd) AllocateNext

func (e *Etcd) AllocateNext() (int, bool, error)

AllocateNext attempts to allocate the next item.

func (*Etcd) CreateOrUpdate

func (e *Etcd) CreateOrUpdate(snapshot *api.RangeAllocation) error

CreateOrUpdate attempts to update the current etcd state with the provided allocation.

func (*Etcd) Destroy

func (e *Etcd) Destroy()

Destroy implement allocator.Interface::Destroy

func (*Etcd) ForEach

func (e *Etcd) ForEach(fn func(int))

func (*Etcd) Free

func (e *Etcd) Free() int

Free implements allocator.Interface::Free

func (*Etcd) Get

func (e *Etcd) Get() (*api.RangeAllocation, error)

Get returns an api.RangeAllocation that represents the current state in etcd. If the key does not exist, the object will have an empty ResourceVersion.

func (*Etcd) Has

func (e *Etcd) Has(item int) bool

Has implements allocator.Interface::Has

func (*Etcd) Release

func (e *Etcd) Release(item int) error

Release attempts to release the provided item.

Source Files

storage.go

Version
v1.33.0 (latest)
Published
Apr 23, 2025
Platform
linux/amd64
Imports
15 packages
Last checked
3 hours ago

Tools for package owners.