com.scalar.db.util.groupcommit.KeyManipulator Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalardb Show documentation
Show all versions of scalardb Show documentation
A universal transaction manager that achieves database-agnostic transactions and distributed transactions that span multiple databases
The newest version!
package com.scalar.db.util.groupcommit;
import com.google.common.base.MoreObjects;
import javax.annotation.concurrent.Immutable;
/**
* A key manipulator which contains logics how to treat keys.
*
* @param A key type to NormalGroup which contains multiple slots and is
* group-committed.
* @param A key type to slot in NormalGroup which can contain a value ready to commit.
* @param A key type to DelayedGroup which contains a single slot and is
* singly-committed.
* @param A parent-key type that Emitter can interpret.
* @param A full-key type that Emitter can interpret.
*/
@Immutable
public interface KeyManipulator {
class Keys {
public final PARENT_KEY parentKey;
public final CHILD_KEY childKey;
public final FULL_KEY fullKey;
public Keys(PARENT_KEY parentKey, CHILD_KEY childKey, FULL_KEY fullKey) {
this.parentKey = parentKey;
this.childKey = childKey;
this.fullKey = fullKey;
}
@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("parentKey", parentKey)
.add("childKey", childKey)
.add("fullKey", fullKey)
.toString();
}
}
PARENT_KEY generateParentKey();
FULL_KEY fullKey(PARENT_KEY parentKey, CHILD_KEY childKey);
boolean isFullKey(Object obj);
Keys keysFromFullKey(FULL_KEY fullKey);
EMIT_FULL_KEY emitFullKeyFromFullKey(FULL_KEY fullKey);
EMIT_PARENT_KEY emitParentKeyFromParentKey(PARENT_KEY parentKey);
}