Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
Public Member Functions | List of all members
plasma::EvictionPolicy Class Reference

The eviction policy. More...

#include <plasma/eviction_policy.h>

Public Member Functions

 EvictionPolicy (PlasmaStoreInfo *store_info)
 Construct an eviction policy. More...
 
void object_created (const ObjectID &object_id)
 This method will be called whenever an object is first created in order to add it to the LRU cache. More...
 
bool require_space (int64_t size, std::vector< ObjectID > *objects_to_evict)
 This method will be called when the Plasma store needs more space, perhaps to create a new object. More...
 
void begin_object_access (const ObjectID &object_id, std::vector< ObjectID > *objects_to_evict)
 This method will be called whenever an unused object in the Plasma store starts to be used. More...
 
void end_object_access (const ObjectID &object_id, std::vector< ObjectID > *objects_to_evict)
 This method will be called whenever an object in the Plasma store that was being used is no longer being used. More...
 
int64_t choose_objects_to_evict (int64_t num_bytes_required, std::vector< ObjectID > *objects_to_evict)
 Choose some objects to evict from the Plasma store. More...
 

Detailed Description

The eviction policy.

Constructor & Destructor Documentation

◆ EvictionPolicy()

plasma::EvictionPolicy::EvictionPolicy ( PlasmaStoreInfo store_info)
explicit

Construct an eviction policy.

Parameters
store_infoInformation about the Plasma store that is exposed to the eviction policy.

Member Function Documentation

◆ begin_object_access()

void plasma::EvictionPolicy::begin_object_access ( const ObjectID object_id,
std::vector< ObjectID > *  objects_to_evict 
)

This method will be called whenever an unused object in the Plasma store starts to be used.

When this method is called, the eviction policy will assume that the objects chosen to be evicted will in fact be evicted from the Plasma store by the caller.

Parameters
object_idThe ID of the object that is now being used.
objects_to_evictThe object IDs that were chosen for eviction will be stored into this vector.

◆ choose_objects_to_evict()

int64_t plasma::EvictionPolicy::choose_objects_to_evict ( int64_t  num_bytes_required,
std::vector< ObjectID > *  objects_to_evict 
)

Choose some objects to evict from the Plasma store.

When this method is called, the eviction policy will assume that the objects chosen to be evicted will in fact be evicted from the Plasma store by the caller.

Note
This method is not part of the API. It is exposed in the header file only for testing.
Parameters
num_bytes_requiredThe number of bytes of space to try to free up.
objects_to_evictThe object IDs that were chosen for eviction will be stored into this vector.
Returns
The total number of bytes of space chosen to be evicted.

◆ end_object_access()

void plasma::EvictionPolicy::end_object_access ( const ObjectID object_id,
std::vector< ObjectID > *  objects_to_evict 
)

This method will be called whenever an object in the Plasma store that was being used is no longer being used.

When this method is called, the eviction policy will assume that the objects chosen to be evicted will in fact be evicted from the Plasma store by the caller.

Parameters
object_idThe ID of the object that is no longer being used.
objects_to_evictThe object IDs that were chosen for eviction will be stored into this vector.

◆ object_created()

void plasma::EvictionPolicy::object_created ( const ObjectID object_id)

This method will be called whenever an object is first created in order to add it to the LRU cache.

This is done so that the first time, the Plasma store calls begin_object_access, we can remove the object from the LRU cache.

Parameters
object_idThe object ID of the object that was created.

◆ require_space()

bool plasma::EvictionPolicy::require_space ( int64_t  size,
std::vector< ObjectID > *  objects_to_evict 
)

This method will be called when the Plasma store needs more space, perhaps to create a new object.

If the required amount of space cannot be freed up, then a fatal error will be thrown. When this method is called, the eviction policy will assume that the objects chosen to be evicted will in fact be evicted from the Plasma store by the caller.

Parameters
sizeThe size in bytes of the new object, including both data and metadata.
objects_to_evictThe object IDs that were chosen for eviction will be stored into this vector.
Returns
True if enough space can be freed and false otherwise.

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