C# Class FoundationDB.Client.Utils.SliceBuffer

Exibir arquivo Open project: BedeGaming/foundationdb-dotnet-client

Public Methods

Method Description
Allocate ( int count, bool aligned = false ) : Slice

Allocate an empty space in the buffer

There is NO garantees that the allocated slice will be pre-filled with zeroes.

Intern ( Slice data, bool aligned = false ) : Slice

Copy a slice into the buffer, with optional alignement, and return a new identical slice.

InternRange ( FdbKeyRange range ) : FdbKeyRange

Copy a pair of keys into the buffer, and return a new identical pair

InternRange ( Slice begin, Slice end ) : FdbKeyRange

Copy a pair of keys into the buffer, and return a new identical pair

InternRangeFromKey ( Slice key ) : FdbKeyRange

Copy a key into the buffer, and return a new range containing only that key

InternSelector ( FdbKeySelector selector ) : FdbKeySelector

Copy a key selector into the buffer, and return a new identical selector

InternSelectorPair ( FdbKeySelectorPair pair ) : FdbKeySelectorPair

Copy a pair of key selectors into the buffer, and return a new identical pair

Reset ( ) : void

Reset the buffer to its initial state

None of the existing buffers are kept, but the new page will keep the current page size (that may be larger than the initial size). Any previously allocated slice from this buffer will be untouched.

ResetUnsafe ( ) : void

Reset the buffer to its initial state, and reuse the current page.

This recycle the current page. The caller should ensure that nobody has a reference to a previously generated slice.

SliceBuffer ( ) : JetBrains.Annotations

Create a new slice buffer with the default page size

SliceBuffer ( int pageSize ) : JetBrains.Annotations

Ceate a new slice buffer with the specified page size

Private Methods

Method Description
AllocateFallback ( int count ) : Slice
GetPages ( ) : Slice[]
Intern ( Slice data, Slice suffix, bool aligned = false ) : Slice

Copy a slice into the buffer, immediately followed by a suffix, and return a new slice that is the concatenation of the two.

When data is empty, suffix is returned without being copied to the buffer itself.

Keep ( Slice chunk ) : void

Adds a buffer to the list of allocated slices

Reset ( bool keep ) : void

Method Details

Allocate() public method

Allocate an empty space in the buffer
There is NO garantees that the allocated slice will be pre-filled with zeroes.
public Allocate ( int count, bool aligned = false ) : Slice
count int Number of bytes to allocate
aligned bool If true, align the start of the slice with the default padding size.
return Slice

Intern() public method

Copy a slice into the buffer, with optional alignement, and return a new identical slice.
public Intern ( Slice data, bool aligned = false ) : Slice
data Slice Data to copy in the buffer
aligned bool If true, align the index of first byte of the slice with a multiple of 8 bytes
return Slice

InternRange() public method

Copy a pair of keys into the buffer, and return a new identical pair
public InternRange ( FdbKeyRange range ) : FdbKeyRange
range FdbKeyRange Key range
return FdbKeyRange

InternRange() public method

Copy a pair of keys into the buffer, and return a new identical pair
public InternRange ( Slice begin, Slice end ) : FdbKeyRange
begin Slice Begin key of the range
end Slice End key of the range
return FdbKeyRange

InternRangeFromKey() public method

Copy a key into the buffer, and return a new range containing only that key
public InternRangeFromKey ( Slice key ) : FdbKeyRange
key Slice Key to copy to the buffer
return FdbKeyRange

InternSelector() public method

Copy a key selector into the buffer, and return a new identical selector
public InternSelector ( FdbKeySelector selector ) : FdbKeySelector
selector FdbKeySelector Key selector to copy to the buffer
return FdbKeySelector

InternSelectorPair() public method

Copy a pair of key selectors into the buffer, and return a new identical pair
public InternSelectorPair ( FdbKeySelectorPair pair ) : FdbKeySelectorPair
pair FdbKeySelectorPair Pair of key selectors to copy to the buffer
return FdbKeySelectorPair

Reset() public method

Reset the buffer to its initial state
None of the existing buffers are kept, but the new page will keep the current page size (that may be larger than the initial size). Any previously allocated slice from this buffer will be untouched.
public Reset ( ) : void
return void

ResetUnsafe() public method

Reset the buffer to its initial state, and reuse the current page.
This recycle the current page. The caller should ensure that nobody has a reference to a previously generated slice.
public ResetUnsafe ( ) : void
return void

SliceBuffer() public method

Create a new slice buffer with the default page size
public SliceBuffer ( ) : JetBrains.Annotations
return JetBrains.Annotations

SliceBuffer() public method

Ceate a new slice buffer with the specified page size
public SliceBuffer ( int pageSize ) : JetBrains.Annotations
pageSize int Initial page size
return JetBrains.Annotations