Skip to content

Commit 1157e32

Browse files
committed
work-in-progress
1 parent 688bce1 commit 1157e32

11 files changed

Lines changed: 607 additions & 312 deletions

src/main/java/com/google/gcloud/datastore/CompleteKey.java

Lines changed: 0 additions & 104 deletions
This file was deleted.
Lines changed: 65 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,78 @@
11
package com.google.gcloud.datastore;
22

3+
import java.util.Iterator;
34
import java.util.Map;
45

56
public interface DatastoreService {
67

7-
DatastoreServiceOptions getOptions();
8+
interface DatastoreReader {
9+
10+
Map<String, Property<?, ?, ?>> get(Key key);
11+
12+
// return the result in the given order
13+
Iterator<Map<String, Property<?, ?, ?>>> get(Iterator<Key> key);
14+
15+
// query result item is a tuple of (key, value...) where values may be empty
16+
//QueryResult runQuery(Query query);
17+
}
18+
19+
20+
interface DatastoreWriter {
21+
22+
Key add(IncompleteKey key, Map<String, Property<?, ?, ?>> values);
23+
24+
void update(Key key , Map<String, Property<?, ?, ?>> values);
25+
26+
Key put(IncompleteKey key, Map<String, Property<?, ?, ?>> values);
27+
28+
void delete(Key key);
29+
}
30+
31+
32+
public interface Transaction extends DatastoreReader, DatastoreWriter {
33+
34+
void commit();
835

9-
CompleteKey put(Key key, Map<String, Property> values);
36+
void rollback();
37+
}
38+
39+
public interface TransactionOptions {
40+
41+
enum IsolationLevel {
42+
SERIALIZABLE, SNAPSHOT;
43+
}
44+
45+
IsolationLevel getIsolationLevel();
46+
}
47+
48+
public interface Batch extends DatastoreWriter {
49+
50+
@Override
51+
void add(Key key, Map<String, Property<?, ?, ?>> values);
52+
53+
@Override
54+
void update(Key key , Map<String, Property<?, ?, ?>> values);
55+
56+
@Override
57+
void put(Key key, Map<String, Property<?, ?, ?>> values);
58+
59+
void submit();
60+
}
61+
62+
public interface BatchOptions {
63+
64+
}
65+
66+
DatastoreServiceOptions getOptions();
1067

11-
Map<String, Property> get(CompleteKey key);
68+
Transaction newTransaction(TransactionOptions tsOptions);
1269

13-
void delete(CompleteKey... key);
70+
Batch newBatch();
1471

15-
void allocateIds(Key... key);
72+
P
1673

17-
// query result item is a tuple of (key, value...) where values may be empty
18-
//QueryResult runQuery(Query query);
74+
Key allocateId(IncompleteKey key);
1975

76+
// results are returned in request order
77+
Iterator<Key> allocateIds(Iterator<IncompleteKey> key);
2078
}
Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.google.gcloud.datastore;
22

3-
import java.util.Map;
43

54
final class DatastoreServiceImpl implements DatastoreService {
65

@@ -10,28 +9,8 @@ final class DatastoreServiceImpl implements DatastoreService {
109
this.options = options;
1110
}
1211

12+
@Override
1313
public DatastoreServiceOptions getOptions() {
14-
// TODO Auto-generated method stub
15-
return null;
16-
}
17-
18-
public CompleteKey put(Key key, Map<String, Property> values) {
19-
// TODO Auto-generated method stub
20-
return null;
21-
}
22-
23-
public Map<String, Property> get(CompleteKey key) {
24-
// TODO Auto-generated method stub
25-
return null;
26-
}
27-
28-
public void delete(CompleteKey... key) {
29-
// TODO Auto-generated method stub
30-
31-
}
32-
33-
public void allocateIds(Key... key) {
34-
// TODO Auto-generated method stub
35-
14+
return options;
3615
}
3716
}

0 commit comments

Comments
 (0)