{"modulePath":"github.com/openshift/origin","version":"v1.5.1","isLatest":false,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package uidallocator\n\n## Variables\n\n```go\nvar (\n\tErrFull            = errors.New(\"range is full\")\n\tErrNotInRange      = errors.New(\"provided UID range is not in the valid range\")\n\tErrAllocated       = errors.New(\"provided UID range is already allocated\")\n\tErrMismatchedRange = errors.New(\"the provided UID range does not match the current UID range\")\n)\n```\n\n## Types\n\n```go\ntype Allocator struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc New(r *uid.Range, factory allocator.AllocatorFactory) *Allocator\n```\nNew creates a Allocator over a UID range, calling factory to construct the backing store.\n\n```go\nfunc NewInMemory(r *uid.Range) *Allocator\n```\nNewInMemory creates an in-memory Allocator\n\n```go\nfunc (r *Allocator) Allocate(block uid.Block) error\n```\nAllocate attempts to reserve the provided block. ErrNotInRange or ErrAllocated will be returned if the block is not valid for this range or has already been reserved.  ErrFull will be returned if there are no blocks left.\n\n```go\nfunc (r *Allocator) AllocateNext() (uid.Block, error)\n```\nAllocateNext reserves one of the ports from the pool. ErrFull may be returned if there are no ports left.\n\n```go\nfunc (r *Allocator) Free() int\n```\nFree returns the count of port left in the range.\n\n```go\nfunc (r *Allocator) Has(block uid.Block) bool\n```\nHas returns true if the provided port is already allocated and a call to Allocate(block) would fail with ErrAllocated.\n\n```go\nfunc (r *Allocator) Release(block uid.Block) error\n```\nRelease releases the port back to the pool. Releasing an unallocated port or a port out of the range is a no-op and returns no error.\n\n```go\nfunc (r *Allocator) Restore(into *uid.Range, data []byte) error\n```\nRestore restores the pool to the previously captured state. ErrMismatchedNetwork is returned if the provided port range doesn't exactly match the previous range.\n\n```go\nfunc (r *Allocator) Snapshot(dst *api.RangeAllocation) error\n```\nSnapshot saves the current state of the pool.\n\n```go\ntype Interface interface {\n\tAllocate(uid.Block) error\n\tAllocateNext() (uid.Block, error)\n\tRelease(uid.Block) error\n}\n```\nInterface manages the allocation of ports out of a range. Interface should be threadsafe.\n\n","path":"github.com/openshift/origin/pkg/security/uidallocator","name":"uidallocator","synopsis":"","isRedistributable":true}
