forked from typedb/typedb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TypeDB.java
115 lines (73 loc) · 2.79 KB
/
TypeDB.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
/*
* Copyright (C) 2022 Vaticle
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
package com.vaticle.typedb.core;
import com.vaticle.typedb.common.collection.Pair;
import com.vaticle.typedb.core.common.collection.ByteArray;
import com.vaticle.typedb.core.common.iterator.FunctionalIterator;
import com.vaticle.typedb.core.common.parameters.Arguments;
import com.vaticle.typedb.core.common.parameters.Context;
import com.vaticle.typedb.core.common.parameters.Options;
import com.vaticle.typedb.core.concept.ConceptManager;
import com.vaticle.typedb.core.logic.LogicManager;
import com.vaticle.typedb.core.query.QueryManager;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Stream;
public interface TypeDB {
interface DatabaseManager extends AutoCloseable {
boolean isOpen();
boolean contains(String name);
Database create(String name);
Database get(String name);
Set<? extends Database> all();
Session session(String database, Arguments.Session.Type type);
Session session(String database, Arguments.Session.Type type, Options.Session options);
void close();
}
interface Database {
String name();
boolean contains(UUID sessionID);
Session session(UUID sessionID);
Stream<Session> sessions();
String schema();
String typeSchema();
String ruleSchema();
void delete();
}
interface Session extends AutoCloseable {
Transaction transaction(Arguments.Transaction.Type type);
Transaction transaction(Arguments.Transaction.Type type, Options.Transaction options);
UUID uuid();
Arguments.Session.Type type();
Database database();
boolean isOpen();
void close();
}
interface Transaction extends AutoCloseable {
Arguments.Transaction.Type type();
Context.Transaction context();
boolean isOpen();
ConceptManager concepts();
LogicManager logic();
QueryManager query();
void commit();
void rollback();
void close();
FunctionalIterator<Pair<ByteArray, ByteArray>> committedIIDs();
}
}