2016-08-13 17:11:11 -07:00
|
|
|
#ifndef PLASMA_H
|
|
|
|
#define PLASMA_H
|
|
|
|
|
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <errno.h>
|
2016-09-10 16:39:24 -07:00
|
|
|
#include <stddef.h>
|
2016-08-13 17:11:11 -07:00
|
|
|
#include <string.h>
|
|
|
|
|
2016-10-03 18:29:18 -07:00
|
|
|
#include "common.h"
|
2016-09-13 16:45:44 -07:00
|
|
|
|
2016-08-13 17:11:11 -07:00
|
|
|
typedef struct {
|
2016-09-14 14:20:34 -07:00
|
|
|
int64_t data_size;
|
|
|
|
int64_t metadata_size;
|
2016-08-13 17:11:11 -07:00
|
|
|
int64_t create_time;
|
|
|
|
int64_t construct_duration;
|
|
|
|
} plasma_object_info;
|
|
|
|
|
2016-10-03 18:29:18 -07:00
|
|
|
/* Handle to access memory mapped file and map it into client address space */
|
|
|
|
typedef struct {
|
|
|
|
/** The file descriptor of the memory mapped file in the store. It is used
|
|
|
|
* as a unique identifier of the file in the client to look up the
|
|
|
|
* corresponding file descriptor on the client's side. */
|
|
|
|
int store_fd;
|
|
|
|
/** The size in bytes of the memory mapped file. */
|
|
|
|
int64_t mmap_size;
|
|
|
|
} object_handle;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
/** Handle for memory mapped file the object is stored in. */
|
|
|
|
object_handle handle;
|
|
|
|
/** The offset in bytes in the memory mapped file of the data. */
|
|
|
|
ptrdiff_t data_offset;
|
|
|
|
/** The offset in bytes in the memory mapped file of the metadata. */
|
|
|
|
ptrdiff_t metadata_offset;
|
|
|
|
/** The size in bytes of the data. */
|
|
|
|
int64_t data_size;
|
|
|
|
/** The size in bytes of the metadata. */
|
|
|
|
int64_t metadata_size;
|
|
|
|
} plasma_object;
|
|
|
|
|
|
|
|
enum object_status { OBJECT_NOT_FOUND = 0, OBJECT_FOUND = 1 };
|
2016-08-13 17:11:11 -07:00
|
|
|
|
2016-10-03 18:29:18 -07:00
|
|
|
enum plasma_message_type {
|
2016-09-28 18:59:00 -07:00
|
|
|
/** Create a new object. */
|
2016-10-03 18:29:18 -07:00
|
|
|
PLASMA_CREATE = 128,
|
2016-09-28 18:59:00 -07:00
|
|
|
/** Get an object. */
|
2016-09-07 20:19:37 -07:00
|
|
|
PLASMA_GET,
|
2016-09-28 18:59:00 -07:00
|
|
|
/** Check if an object is present. */
|
2016-09-23 15:07:50 -07:00
|
|
|
PLASMA_CONTAINS,
|
2016-09-28 18:59:00 -07:00
|
|
|
/** Seal an object. */
|
2016-09-07 20:19:37 -07:00
|
|
|
PLASMA_SEAL,
|
2016-09-28 18:59:00 -07:00
|
|
|
/** Delete an object. */
|
2016-09-23 15:07:50 -07:00
|
|
|
PLASMA_DELETE,
|
2016-09-28 18:59:00 -07:00
|
|
|
/** Request transfer to another store. */
|
2016-09-07 20:19:37 -07:00
|
|
|
PLASMA_TRANSFER,
|
2016-09-28 18:59:00 -07:00
|
|
|
/** Header for sending data. */
|
2016-09-07 20:19:37 -07:00
|
|
|
PLASMA_DATA,
|
2016-08-13 17:11:11 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct {
|
2016-09-28 18:59:00 -07:00
|
|
|
/** The ID of the object that the request is about. */
|
2016-10-03 18:29:18 -07:00
|
|
|
object_id object_id;
|
2016-09-28 18:59:00 -07:00
|
|
|
/** The size of the object's data. */
|
2016-09-14 14:20:34 -07:00
|
|
|
int64_t data_size;
|
2016-09-28 18:59:00 -07:00
|
|
|
/** The size of the object's metadata. */
|
2016-09-14 14:20:34 -07:00
|
|
|
int64_t metadata_size;
|
2016-09-28 18:59:00 -07:00
|
|
|
/** In a transfer request, this is the IP address of the Plasma Manager to
|
|
|
|
* transfer the object to. */
|
2016-08-15 16:41:22 -07:00
|
|
|
uint8_t addr[4];
|
2016-09-28 18:59:00 -07:00
|
|
|
/** In a transfer request, this is the port of the Plasma Manager to transfer
|
|
|
|
* the object to. */
|
2016-08-15 16:41:22 -07:00
|
|
|
int port;
|
2016-08-13 17:11:11 -07:00
|
|
|
} plasma_request;
|
|
|
|
|
|
|
|
typedef struct {
|
2016-10-03 18:29:18 -07:00
|
|
|
/** The object that is returned with this reply. */
|
|
|
|
plasma_object object;
|
2016-09-28 18:59:00 -07:00
|
|
|
/** This is used only to respond to requests of type PLASMA_CONTAINS. It is 1
|
|
|
|
* if the object is present and 0 otherwise. Used for plasma_contains. */
|
2016-09-23 15:07:50 -07:00
|
|
|
int has_object;
|
2016-08-13 17:11:11 -07:00
|
|
|
} plasma_reply;
|
|
|
|
|
|
|
|
#endif
|