-
Notifications
You must be signed in to change notification settings - Fork 0
OBSR
OBject StoRage (or OBSR) is a distributed, hierarchical, object storage. Each Object (i.e. StoredObject
) is a data structure, composed of typed fields called Entries (i.e. StoredEntry
) and child Objects. The Object Storage is composed of a root Object. The rest of the Objects are children of the root Object.
OBSR connected processes, called nodes, each hold a copy of the stored data, and report to each other on any changes. One node is the primary node, i.e. it serves as both a storage (like the other nodes) and a broker, for distributing information on changes between all the nodes. Non-primary nodes are referred to as secondary nodes.
The OBSR protocol is based on FlashLib's messaging protocol with a TCP backend. The primary node is basically the server and secondary nodes are clients.
The main OBSR interface is ObjectStorage
, provided via the NetworkInterface
component in FlashLibControl
.
Normally, OBSR should be used to describe an object in code, sharable with other OBSR nodes.
public class AnObject {
private final IntProperty mField1;
private final BooleanProperty mField2;
public AnObject(StoredObject object) {
mField1 = object.getEntry("field1").valueProperty().asInt(0);
mField2 = object.getEntry("field2").valueProperty().asBoolean(false);
}
public int getField1() {
return mField1.getAsInt();
}
public void setField1(int field1) {
mField1.setAsInt(field1);
}
public boolean getField2() {
return mField2.getAsBoolean();
}
public void setField2(boolean field2) {
mField2.setAsBoolean(field2);
}
}