Package com.google.datastore.v1.client (2.18.5)

Classes

Datastore

Provides access to Cloud Datastore.

This class is thread-safe.

DatastoreEmulator

An extension to Datastore that provides lifecycle management for a datastore emulator.

In order to use the emulator for a JUnit 4 test you might do something like this:

public class MyTest {

static DatastoreEmulator datastore;

@BeforeClass public static void startEmulator() throws DatastoreEmulatorException { DatastoreOptions options = new DatastoreOptions.Builder() .localHost("localhost:8080") .projectId("my-project-id") .build(); datastore = DatastoreEmulatorFactory.get().create(options); datastore.start("/usr/local/cloud-datastore-emulator", "my-project-id"); }

@Before public void setUp() throws DatastoreEmulatorException { datastore.clear(); }

@AfterClass public static void stopEmulator() throws DatastoreEmulatorException { datastore.stop(); }

@Test public void testFoo1() { }

@Test public void testFoo2() { }

}

DatastoreEmulatorFactory

Factory for DatastoreEmulator.

DatastoreEmulatorOptions

An immutable object containing settings for a DatastoreEmulator.

DatastoreEmulatorOptions.Builder

Builder for DatastoreEmulatorOptions.

DatastoreFactory

Client factory for Datastore.

DatastoreHelper

Helper methods for Datastore.

DatastoreOptions

An immutable object containing settings for the datastore.

Example for connecting to a datastore:

DatastoreOptions options = new DatastoreOptions.Builder() .projectId("my-project-id") .credential(DatastoreHelper.getComputeEngineCredential()) .build(); DatastoreFactory.get().create(options);

The options should be passed to DatastoreFactory#create.

DatastoreOptions.Builder

Builder for DatastoreOptions.

Interfaces

QuerySplitter

Provides the ability to split a query into multiple shards.

Exceptions

DatastoreEmulatorException

An exception related to the DatastoreEmulator.

DatastoreException

Indicates an error in a Datastore call.