LLVM 22.0.0git
llvm::cas::OnDiskDataAllocator Class Reference

Sink for data. More...

#include "llvm/CAS/OnDiskDataAllocator.h"

Classes

struct  ImplType
class  OnDiskPtr
 A pointer to data stored on disk. More...

Public Types

using ValueProxy = MutableArrayRef<char>

Public Member Functions

LLVM_ABI_FOR_TEST Expected< ArrayRef< char > > get (FileOffset Offset, size_t Size) const
 Get the data of Size stored at the given Offset.
LLVM_ABI_FOR_TEST Expected< OnDiskPtrallocate (size_t Size)
 Allocate at least Size with 8-byte alignment.
MutableArrayRef< uint8_tgetUserHeader () const
LLVM_ABI_FOR_TEST size_t size () const
LLVM_ABI_FOR_TEST size_t capacity () const
LLVM_ABI_FOR_TEST OnDiskDataAllocator (OnDiskDataAllocator &&RHS)
LLVM_ABI_FOR_TEST OnDiskDataAllocatoroperator= (OnDiskDataAllocator &&RHS)
 OnDiskDataAllocator (const OnDiskDataAllocator &)=delete
OnDiskDataAllocatoroperator= (const OnDiskDataAllocator &)=delete
LLVM_ABI_FOR_TEST ~OnDiskDataAllocator ()

Static Public Member Functions

static LLVM_ABI_FOR_TEST Expected< OnDiskDataAllocatorcreate (const Twine &Path, const Twine &TableName, uint64_t MaxFileSize, std::optional< uint64_t > NewFileInitialSize, uint32_t UserHeaderSize=0, function_ref< void(void *)> UserHeaderInit=nullptr)

Detailed Description

Sink for data.

Stores variable length data with 8-byte alignment. Does not track size of data, which is assumed to known from context, or embedded. Uses 0-padding but does not guarantee 0-termination.

Definition at line 29 of file OnDiskDataAllocator.h.

Member Typedef Documentation

◆ ValueProxy

Constructor & Destructor Documentation

◆ OnDiskDataAllocator() [1/2]

OnDiskDataAllocator::OnDiskDataAllocator ( OnDiskDataAllocator && RHS)
default

◆ OnDiskDataAllocator() [2/2]

llvm::cas::OnDiskDataAllocator::OnDiskDataAllocator ( const OnDiskDataAllocator & )
delete

References OnDiskDataAllocator().

◆ ~OnDiskDataAllocator()

OnDiskDataAllocator::~OnDiskDataAllocator ( )
default

References LLVM_ABI_FOR_TEST.

Member Function Documentation

◆ allocate()

Expected< OnDiskDataAllocator::OnDiskPtr > OnDiskDataAllocator::allocate ( size_t Size)

Allocate at least Size with 8-byte alignment.

Definition at line 213 of file OnDiskDataAllocator.cpp.

References llvm::createStringError(), llvm::make_error_code(), and Size.

◆ capacity()

size_t OnDiskDataAllocator::capacity ( ) const

Definition at line 229 of file OnDiskDataAllocator.cpp.

◆ create()

Expected< OnDiskDataAllocator > OnDiskDataAllocator::create ( const Twine & Path,
const Twine & TableName,
uint64_t MaxFileSize,
std::optional< uint64_t > NewFileInitialSize,
uint32_t UserHeaderSize = 0,
function_ref< void(void *)> UserHeaderInit = nullptr )
static

◆ get()

Expected< ArrayRef< char > > OnDiskDataAllocator::get ( FileOffset Offset,
size_t Size ) const

Get the data of Size stored at the given Offset.

Note the allocator doesn't keep track of the allocation size, thus Size doesn't need to match the size of allocation but needs to be smaller.

Definition at line 218 of file OnDiskDataAllocator.cpp.

References llvm::createStringError(), llvm::make_error_code(), llvm::Offset, and Size.

◆ getUserHeader()

MutableArrayRef< uint8_t > OnDiskDataAllocator::getUserHeader ( ) const
Returns
the buffer that was allocated at create time, with size UserHeaderSize.

Definition at line 224 of file OnDiskDataAllocator.cpp.

◆ operator=() [1/2]

OnDiskDataAllocator & llvm::cas::OnDiskDataAllocator::operator= ( const OnDiskDataAllocator & )
delete

References OnDiskDataAllocator().

◆ operator=() [2/2]

OnDiskDataAllocator & OnDiskDataAllocator::operator= ( OnDiskDataAllocator && RHS)
default

◆ size()

size_t OnDiskDataAllocator::size ( ) const

Definition at line 228 of file OnDiskDataAllocator.cpp.


The documentation for this class was generated from the following files: