Documentation ¶
Overview ¶
Package cookie implements a cookie allocator. The preallocated cookies are used to classify flows in the vSwitch, which simplifies management of these flows.
Index ¶
Constants ¶
View Source
const ( BitwidthRound = 16 BitwidthCategory = 8 BitwidthReserved = 64 - BitwidthCategory - BitwidthRound RoundMask uint64 = 0xffff_0000_0000_0000 CategoryMask uint64 = 0x0000_ff00_0000_0000 )
Variables ¶
This section is empty.
Functions ¶
func CookieMaskForRound ¶
CookieMaskForRound returns a cookie and mask value that can be used to select all flows belonging to the provided round.
Types ¶
type Allocator ¶
type Allocator interface { // Request gets a cookie IDs of the flow category. Request(cat Category) ID // RequestWithObjectID gets a cookie ID of the flow category and objectID. RequestWithObjectID(cat Category, objectID uint32) ID }
Allocator defines operations of a cookie ID allocator.
func NewAllocator ¶
NewAllocator creates a cookie ID allocator by using the given round number. Only last 16 bits of the round number would be used.
type ID ¶
type ID uint64
ID defines segments a cookie ID contains. An ID is composed like:
|------------------------- ID --------------------------| |- round 16bits -|- category 8bits -|- reserved 8bits -|- objectID 32bits -|
The round segment represents the round id. The category segment represents the category of flow this ID belongs.
Click to show internal directories.
Click to hide internal directories.