Search in sources :

Example 1 with BackendStore

use of com.baidu.hugegraph.backend.store.BackendStore in project incubator-hugegraph by apache.

the class StandardTaskScheduler method tx.

private TaskTransaction tx() {
    // NOTE: only the owner thread can access task tx
    if (this.taskTx == null) {
        /*
             * NOTE: don't synchronized(this) due to scheduler thread hold
             * this lock through scheduleTasks(), then query tasks and wait
             * for db-worker thread after call(), the tx may not be initialized
             * but can't catch this lock, then cause dead lock.
             * We just use this.eventListener as a monitor here
             */
        synchronized (this.eventListener) {
            if (this.taskTx == null) {
                BackendStore store = this.graph.loadSystemStore();
                TaskTransaction tx = new TaskTransaction(this.graph, store);
                // may be reentrant?
                assert this.taskTx == null;
                this.taskTx = tx;
            }
        }
    }
    assert this.taskTx != null;
    return this.taskTx;
}
Also used : BackendStore(com.baidu.hugegraph.backend.store.BackendStore)

Example 2 with BackendStore

use of com.baidu.hugegraph.backend.store.BackendStore in project incubator-hugegraph by apache.

the class RaftBackendStoreProvider method loadGraphStore.

@Override
public synchronized BackendStore loadGraphStore(HugeConfig config, String name) {
    if (this.graphStore == null) {
        LOG.info("Init raft backend graph store");
        BackendStore store = this.provider.loadGraphStore(config, name);
        this.checkNonSharedStore(store);
        this.graphStore = new RaftBackendStore(store, this.context);
        this.context.addStore(StoreType.GRAPH, this.graphStore);
    }
    return this.graphStore;
}
Also used : BackendStore(com.baidu.hugegraph.backend.store.BackendStore)

Example 3 with BackendStore

use of com.baidu.hugegraph.backend.store.BackendStore in project incubator-hugegraph by apache.

the class RaftBackendStoreProvider method loadSchemaStore.

@Override
public synchronized BackendStore loadSchemaStore(HugeConfig config, String name) {
    if (this.schemaStore == null) {
        LOG.info("Init raft backend schema store");
        BackendStore store = this.provider.loadSchemaStore(config, name);
        this.checkNonSharedStore(store);
        this.schemaStore = new RaftBackendStore(store, this.context);
        this.context.addStore(StoreType.SCHEMA, this.schemaStore);
    }
    return this.schemaStore;
}
Also used : BackendStore(com.baidu.hugegraph.backend.store.BackendStore)

Example 4 with BackendStore

use of com.baidu.hugegraph.backend.store.BackendStore in project incubator-hugegraph by apache.

the class StoreDumper method dump.

public void dump(HugeType table, long offset, long limit) {
    BackendStore store = this.backendStore(table);
    Query query = new Query(table);
    Iterator<BackendEntry> rs = store.query(query);
    for (long i = 0; i < offset && rs.hasNext(); i++) {
        rs.next();
    }
    LOG.info("Dump table {} (offset {} limit {}):", table, offset, limit);
    for (long i = 0; i < limit && rs.hasNext(); i++) {
        BackendEntry entry = rs.next();
        LOG.info("{}", entry);
    }
    CloseableIterator.closeIterator(rs);
}
Also used : BackendEntry(com.baidu.hugegraph.backend.store.BackendEntry) Query(com.baidu.hugegraph.backend.query.Query) BackendStore(com.baidu.hugegraph.backend.store.BackendStore)

Example 5 with BackendStore

use of com.baidu.hugegraph.backend.store.BackendStore in project incubator-hugegraph by apache.

the class RaftBackendStoreProvider method loadSystemStore.

@Override
public synchronized BackendStore loadSystemStore(HugeConfig config, String name) {
    if (this.systemStore == null) {
        LOG.info("Init raft backend system store");
        BackendStore store = this.provider.loadSystemStore(config, name);
        this.checkNonSharedStore(store);
        this.systemStore = new RaftBackendStore(store, this.context);
        this.context.addStore(StoreType.SYSTEM, this.systemStore);
    }
    return this.systemStore;
}
Also used : BackendStore(com.baidu.hugegraph.backend.store.BackendStore)

Aggregations

BackendStore (com.baidu.hugegraph.backend.store.BackendStore)8 Query (com.baidu.hugegraph.backend.query.Query)1 BackendEntry (com.baidu.hugegraph.backend.store.BackendEntry)1 BackendMutation (com.baidu.hugegraph.backend.store.BackendMutation)1 IncrCounter (com.baidu.hugegraph.backend.store.raft.RaftBackendStore.IncrCounter)1