2016-10-03 18:29:18 -07:00
|
|
|
#ifndef PLASMA_STORE_H
|
|
|
|
#define PLASMA_STORE_H
|
|
|
|
|
|
|
|
#include "plasma.h"
|
|
|
|
|
2016-10-11 17:58:14 -07:00
|
|
|
typedef struct plasma_store_state plasma_store_state;
|
|
|
|
|
2016-10-03 18:29:18 -07:00
|
|
|
/**
|
|
|
|
* Create a new object:
|
|
|
|
*
|
2016-10-11 17:58:14 -07:00
|
|
|
* @param s The plasma store state.
|
2016-10-03 18:29:18 -07:00
|
|
|
* @param object_id Object ID of the object to be created.
|
|
|
|
* @param data_size Size in bytes of the object to be created.
|
|
|
|
* @param metadata_size Size in bytes of the object metadata.
|
2016-10-12 12:58:15 -07:00
|
|
|
* @return Void.
|
2016-10-03 18:29:18 -07:00
|
|
|
*/
|
2016-10-12 12:58:15 -07:00
|
|
|
void create_object(plasma_store_state *s,
|
|
|
|
object_id object_id,
|
|
|
|
int64_t data_size,
|
|
|
|
int64_t metadata_size,
|
|
|
|
plasma_object *result);
|
2016-10-03 18:29:18 -07:00
|
|
|
|
|
|
|
/**
|
2016-10-18 18:20:59 -07:00
|
|
|
* Get an object. This method assumes that we currently have or will
|
|
|
|
* eventually have this object sealed. If the object has not yet been sealed,
|
|
|
|
* the client that requested the object will be notified when it is sealed.
|
2016-10-03 18:29:18 -07:00
|
|
|
*
|
2016-10-11 17:58:14 -07:00
|
|
|
* @param s The plasma store state.
|
|
|
|
* @param conn The client connection that requests the object.
|
2016-10-03 18:29:18 -07:00
|
|
|
* @param object_id Object ID of the object to be gotten.
|
2016-10-11 17:58:14 -07:00
|
|
|
* @return The status of the object (object_status in plasma.h).
|
2016-10-03 18:29:18 -07:00
|
|
|
*/
|
2016-10-11 17:58:14 -07:00
|
|
|
int get_object(plasma_store_state *s,
|
|
|
|
int conn,
|
|
|
|
object_id object_id,
|
|
|
|
plasma_object *result);
|
2016-10-03 18:29:18 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Seal an object:
|
|
|
|
*
|
2016-10-11 17:58:14 -07:00
|
|
|
* @param s The plasma store state.
|
2016-10-03 18:29:18 -07:00
|
|
|
* @param object_id Object ID of the object to be sealed.
|
|
|
|
* @param conns Returns the connection that are waiting for this object.
|
|
|
|
The caller is responsible for destroying this array.
|
2016-10-11 17:58:14 -07:00
|
|
|
* @return Void.
|
2016-10-03 18:29:18 -07:00
|
|
|
*/
|
2016-10-11 17:58:14 -07:00
|
|
|
void seal_object(plasma_store_state *s,
|
|
|
|
object_id object_id,
|
|
|
|
UT_array **conns,
|
|
|
|
plasma_object *result);
|
2016-10-03 18:29:18 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Check if the plasma store contains an object:
|
|
|
|
*
|
2016-10-11 17:58:14 -07:00
|
|
|
* @param s The plasma store state.
|
2016-10-03 18:29:18 -07:00
|
|
|
* @param object_id Object ID that will be checked.
|
2016-10-11 17:58:14 -07:00
|
|
|
* @return OBJECT_FOUND if the object is in the store, OBJECT_NOT_FOUND if not
|
|
|
|
*/
|
|
|
|
int contains_object(plasma_store_state *s, object_id object_id);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete an object from the plasma store:
|
|
|
|
*
|
|
|
|
* @param s The plasma store state.
|
|
|
|
* @param object_id Object ID of the object to be deleted.
|
|
|
|
* @return Void.
|
2016-10-03 18:29:18 -07:00
|
|
|
*/
|
2016-10-11 17:58:14 -07:00
|
|
|
void delete_object(plasma_store_state *s, object_id object_id);
|
2016-10-03 18:29:18 -07:00
|
|
|
|
2016-10-14 19:27:17 -07:00
|
|
|
/**
|
|
|
|
* Send notifications about sealed objects to the subscribers. This is called
|
|
|
|
* in seal_object. If the socket's send buffer is full, the notification will be
|
|
|
|
* buffered, and this will be called again when the send buffer has room.
|
|
|
|
*
|
|
|
|
* @param loop The Plasma store event loop.
|
|
|
|
* @param client_sock The file descriptor to send the notification to.
|
|
|
|
* @param context The plasma store global state.
|
|
|
|
* @param events This is needed for this function to have the signature of a
|
|
|
|
callback.
|
|
|
|
* @return Void.
|
|
|
|
*/
|
|
|
|
void send_notifications(event_loop *loop,
|
|
|
|
int client_sock,
|
|
|
|
void *context,
|
|
|
|
int events);
|
|
|
|
|
2016-10-03 18:29:18 -07:00
|
|
|
#endif /* PLASMA_STORE_H */
|