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

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

Static Public Member Functions

static 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

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 227 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

Definition at line 204 of file OnDiskDataAllocator.cpp.

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

◆ 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 ( )
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

References OnDiskDataAllocator(), and RHS.

◆ size()

size_t OnDiskDataAllocator::size ( ) const

Definition at line 226 of file OnDiskDataAllocator.cpp.


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