@x5e/gink
Version:
an eventually consistent database
38 lines (37 loc) • 1.84 kB
TypeScript
import { Addressable } from "./Addressable";
import { Database } from "./Database";
import { AsOf, EdgeData, Muid, Value, Timestamp, Meta } from "./typedefs";
import { Vertex } from "./Vertex";
import { EdgeType } from "./EdgeType";
export declare class Edge extends Addressable {
readonly database: Database;
private source;
private target;
private action;
private value?;
private constructor();
static get(database: Database, muid: Muid, data: EdgeData): Edge;
private setFromEdgeData;
static load(database: Database, address: Muid): Promise<Edge>;
getSourceVertex(): Vertex;
getTargetVertex(): Vertex;
getEdgeType(): EdgeType;
getValue(): Value | undefined;
/**
* NOTE: If this edge has been removed, or if its edgeType has been reset, this method will ALWAYS return false.
* If its edgeType has been reset, it has been replaced with a new edge that has the exact same source, target, value,
* and properties. Check getEdgesTo and getEdgesFrom on the source and target vertices to find replaced edges.
*/
isAlive(asOf?: AsOf): Promise<boolean>;
getEffective(asOf?: AsOf): Promise<Timestamp>;
/**
* If dest is not provided (or 0), the edge will be removed. This exact edge
* with the same Muid will never exist again. The only way to "revive" it is to reset
* the database or its edgeType. In that case, a new edge will be created with the same
* source, target, value, and properties.
* @param dest a timestamp to move the edge to. If 0 or not specified, the edge will be removed.
* @param purge completely remove the edge's entry from the datastore?
* @param meta optional metadata (may contain: comment, identity, or bundler)
*/
remove(dest?: number, purge?: boolean, meta?: Meta): Promise<void>;
}