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 ObjectCreated (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 RequireSpace (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 BeginObjectAccess (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 EndObjectAccess (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 ChooseObjectsToEvict (int64_t num_bytes_required, std::vector< ObjectID > *objects_to_evict)
 Choose some objects to evict from the Plasma store. More...
 
void RemoveObject (const ObjectID &object_id)
 This method will be called when an object is going to be removed. 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

◆ BeginObjectAccess()

void plasma::EvictionPolicy::BeginObjectAccess ( 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.

◆ ChooseObjectsToEvict()

int64_t plasma::EvictionPolicy::ChooseObjectsToEvict ( 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.

◆ EndObjectAccess()

void plasma::EvictionPolicy::EndObjectAccess ( 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.

◆ ObjectCreated()

void plasma::EvictionPolicy::ObjectCreated ( 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.

◆ RemoveObject()

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

This method will be called when an object is going to be removed.

Parameters
object_idThe ID of the object that is now being used.

◆ RequireSpace()

bool plasma::EvictionPolicy::RequireSpace ( 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.

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: