Developer documentation for Plasma

The IPC interface

module plasma.service;

struct ObjectInfo {
  string name;
  uint64 size;
  int64 create_time;
  int64 construct_delta;
  int64 creator_id;
};

[ServiceName="plasma::service::Plasma"]
interface Plasma {
  CreateObject(int64 object_id, uint64 size, string name, int64 creator_id)
    => (handle<shared_buffer> buffer);
  ResizeObject(int64 object_id, uint64 new_size)
    => (handle<shared_buffer> buffer);
  SealObject(int64 object_id);
  GetObject(int64 object_id, bool block)
    => (handle<shared_buffer> buffer, uint64 size);
  ListObjects()
    => (array<ObjectInfo> info);
};

Internal classes

class plasma::service::PlasmaEntry

An entry in the hash table of objects stored in the local object store.

Public Members

mojo::ScopedSharedBufferHandle handle

Handle to the shared memory buffer where the object is stored.

ObjectInfoPtr object_info

ObjectInfo (see plasma.mojom)

class plasma::service::PlasmaImpl

Implementation of the Plasma service interface. This implementation is single threaded, which means we do not have to lock the datastructures.

Inherits from Plasma

Public Functions

void CreateObject(int64 object_id, uint64 size, const mojo::String &name, int64 creator_id, const CreateObjectCallback &callback)

Creates a new object..

Return
Shared memory handle to the read-write memory of the object
Parameters
  • object_id -

    Unique identifier of the object to be build

  • size -

    Initial number of bytes to be allocated for the object

  • name -

    User defined name of the object

void pass_sealed_object(int64 object_id, const GetObjectCallback &callback)

Pass a sealed object to a client that has been waiting.

void SealObject(int64 object_id)

Seal an object, making it immutable.

Parameters
  • object_id -

    Unique identifier of the object to be sealed

void GetObject(int64 object_id, bool block, const GetObjectCallback &callback)

Get an object from the object store.

Return
Handle to the object and size of the object in bytes
Parameters
  • object_id -

    Unique identifier of the object that shall be returned

  • block -

    If true, this call will block until the object becomes available. Otherwise, if the object is not in the object store, an error will be raised.

void ListObjects(const ListObjectsCallback &callback)

List objects from the object store.

Return
A list of ObjectInfoData objects that describe the objects in the store.

class plasma::service::PlasmaServerApp

Implementation of the Plasma server. This follows the “SingletonServer” pattern in examples/echo/echo_server.cc (see documentation there). This means that the object store is shared between all the clients running on a given node.

Inherits from ApplicationImplBase

Public Functions

bool OnAcceptConnection(mojo::ServiceProviderImpl *service_provider_impl)

Accept a new connection from a client.