com.google.appengine.api.datastore.dev

## Class LocalDatastoreService

- java.lang.Object
- - AbstractLocalRpcService
  - - com.google.appengine.api.datastore.dev.LocalDatastoreService

-     @ServiceProvider(value=)
      public final class LocalDatastoreService
      extends AbstractLocalRpcService

  A local implementation of the Datastore service interface. This is a memory-based implementation which can persist itself to disk through a batch operation. TODO(tobyr) Improve this implementation such that it's backed by something like Derby (which is bundled with the JDK), perhaps in "iteration 2".

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `BACKING_STORE_PROPERTY` Where to read/store the datastore from/to.
    `static java.lang.String` | `HIGH_REP_JOB_POLICY_CLASS_PROPERTY` The fully-qualifed name of a class that implements `HighRepJobPolicy` and has a no-arg constructor.
    `static int` | `MAX_EG_PER_TXN` The maximum number of entity groups in a transaction.
    `static java.lang.String` | `MAX_QUERY_LIFETIME_PROPERTY` How long a query can stay "live" before we expire it.
    `static java.lang.String` | `MAX_TRANSACTION_LIFETIME_PROPERTY` How long a transaction can stay "live" before we expire it.
    `static java.lang.String` | `NO_INDEX_AUTO_GEN_PROP` True to prevent the datastore from writing `com.google.apphosting.utils.config.IndexesXmlReader#GENERATED_INDEX_FILENAME`.
    `static java.lang.String` | `NO_STORAGE_PROPERTY` True to put the datastore into "memory-only" mode.
    `static java.lang.String` | `PACKAGE` The package name for this service.
    `static java.lang.String` | `STORE_DELAY_PROPERTY` How long to wait before updating the persistent store in milliseconds.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LocalDatastoreService()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `VoidProto` | `addActions(Status status, TaskQueueBulkAddRequest request)`
    `AllocateIdsResponse` | `allocateIds(Status status, AllocateIdsRequest req)`
    `Transaction` | `beginTransaction(Status status, BeginTransactionRequest req)`
    `void` | `clearProfiles()` Clear out the in-memory datastore.
    `void` | `clearQueryHistory()` Clear out the query history that we use for generating indexes.
    `CommitResponse` | `commit(Status status, Transaction req)`
    `Integer64Proto` | `createIndex(Status status, CompositeIndex req)`
    `DeleteResponse` | `delete(Status status, DeleteRequest request)`
    `VoidProto` | `deleteCursor(Status status, Cursor request)`
    `DeleteResponse` | `deleteImpl(Status status, DeleteRequest request)`
    `VoidProto` | `deleteIndex(Status status, CompositeIndex req)`
    `GetResponse` | `get(Status status, GetRequest request)`
    `CreationCostAnalysis` | `getCreationCostAnalysis(com.google.appengine.api.datastore.Entity e)` Return a cost analysis of the operations required to create this entity.
    `java.lang.Double` | `getDefaultDeadline(boolean isOfflineRequest)`
    `CompositeIndices` | `getIndices(Status status, StringProto req)`
    `java.lang.Double` | `getMaximumDeadline(boolean isOfflineRequest)`
    `java.lang.String` | `getPackage()`
    `void` | `init(LocalServiceContext context, java.util.Map<java.lang.String,java.lang.String> properties)`
    `QueryResult` | `next(Status status, NextRequest request)`
    `PutResponse` | `put(Status status, PutRequest request)`
    `PutResponse` | `putImpl(Status status, PutRequest request)`
    `VoidProto` | `rollback(Status status, Transaction req)`
    `QueryResult` | `runQuery(Status status, Query query)`
    `void` | `setBackingStore(java.lang.String backingStore)`
    `void` | `setMaxQueryLifetime(int milliseconds)`
    `void` | `setMaxTransactionLifetime(int milliseconds)`
    `void` | `setNoStorage(boolean noStorage)`
    `void` | `setStoreDelay(int delayMs)`
    `void` | `start()`
    `void` | `stop()`
    `VoidProto` | `updateIndex(Status status, CompositeIndex req)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### PACKAGE

          public static final java.lang.String PACKAGE

      The package name for this service.
      See Also:
        Constant Field Values

    - #### MAX_QUERY_LIFETIME_PROPERTY

          public static final java.lang.String MAX_QUERY_LIFETIME_PROPERTY

      How long a query can stay "live" before we expire it.
      See Also:
        Constant Field Values

    - #### MAX_TRANSACTION_LIFETIME_PROPERTY

          public static final java.lang.String MAX_TRANSACTION_LIFETIME_PROPERTY

      How long a transaction can stay "live" before we expire it.
      See Also:
        Constant Field Values

    - #### STORE_DELAY_PROPERTY

          public static final java.lang.String STORE_DELAY_PROPERTY

      How long to wait before updating the persistent store in milliseconds.
      See Also:
        Constant Field Values

    - #### MAX_EG_PER_TXN

          public static final int MAX_EG_PER_TXN

      The maximum number of entity groups in a transaction.
      See Also:
        Constant Field Values

    - #### BACKING_STORE_PROPERTY

          public static final java.lang.String BACKING_STORE_PROPERTY

      Where to read/store the datastore from/to.
      See Also:
        Constant Field Values

    - #### NO_INDEX_AUTO_GEN_PROP

          public static final java.lang.String NO_INDEX_AUTO_GEN_PROP

      True to prevent the datastore from writing `com.google.apphosting.utils.config.IndexesXmlReader#GENERATED_INDEX_FILENAME`.
      See Also:
        Constant Field Values

    - #### NO_STORAGE_PROPERTY

          public static final java.lang.String NO_STORAGE_PROPERTY

      True to put the datastore into "memory-only" mode.
      See Also:
        Constant Field Values

    - #### HIGH_REP_JOB_POLICY_CLASS_PROPERTY

          public static final java.lang.String HIGH_REP_JOB_POLICY_CLASS_PROPERTY

      The fully-qualifed name of a class that implements `HighRepJobPolicy` and has a no-arg constructor. If not provided we use a `DefaultHighRepJobPolicy`. See the javadoc for this class for information on its configurable properties.
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### LocalDatastoreService

          public LocalDatastoreService()

  - ### Method Detail

    - #### clearProfiles

          public void clearProfiles()

      Clear out the in-memory datastore. Note that this does not clear out any data that has been persisted on disk.

    - #### clearQueryHistory

          public void clearQueryHistory()

      Clear out the query history that we use for generating indexes.

    - #### init

          public void init(LocalServiceContext context,
                  java.util.Map<java.lang.String,java.lang.String> properties)

    - #### start

          public void start()

    - #### stop

          public void stop()

    - #### setMaxQueryLifetime

          public void setMaxQueryLifetime(int milliseconds)

    - #### setMaxTransactionLifetime

          public void setMaxTransactionLifetime(int milliseconds)

    - #### setBackingStore

          public void setBackingStore(java.lang.String backingStore)

    - #### setStoreDelay

          public void setStoreDelay(int delayMs)

    - #### setNoStorage

          public void setNoStorage(boolean noStorage)

    - #### getPackage

          public java.lang.String getPackage()

    - #### get

          public GetResponse get(Status status,
                        GetRequest request)

    - #### put

          public PutResponse put(Status status,
                        PutRequest request)

    - #### putImpl

          public PutResponse putImpl(Status status,
                            PutRequest request)

    - #### delete

          public DeleteResponse delete(Status status,
                              DeleteRequest request)

    - #### addActions

          public VoidProto addActions(Status status,
                             TaskQueueBulkAddRequest request)

    - #### deleteImpl

          public DeleteResponse deleteImpl(Status status,
                                  DeleteRequest request)

    - #### runQuery

          public QueryResult runQuery(Status status,
                             Query query)

    - #### next

          public QueryResult next(Status status,
                         NextRequest request)

    - #### deleteCursor

          public VoidProto deleteCursor(Status status,
                               Cursor request)

    - #### beginTransaction

          public Transaction beginTransaction(Status status,
                                     BeginTransactionRequest req)

    - #### commit

          public CommitResponse commit(Status status,
                              Transaction req)

    - #### rollback

          public VoidProto rollback(Status status,
                           Transaction req)

    - #### createIndex

          public Integer64Proto createIndex(Status status,
                                   CompositeIndex req)

    - #### updateIndex

          public VoidProto updateIndex(Status status,
                              CompositeIndex req)

    - #### getIndices

          public CompositeIndices getIndices(Status status,
                                    StringProto req)

    - #### deleteIndex

          public VoidProto deleteIndex(Status status,
                              CompositeIndex req)

    - #### allocateIds

          public AllocateIdsResponse allocateIds(Status status,
                                        AllocateIdsRequest req)

    - #### getDefaultDeadline

          public java.lang.Double getDefaultDeadline(boolean isOfflineRequest)

    - #### getMaximumDeadline

          public java.lang.Double getMaximumDeadline(boolean isOfflineRequest)

    - #### getCreationCostAnalysis

          public CreationCostAnalysis getCreationCostAnalysis(com.google.appengine.api.datastore.Entity e)

      Return a cost analysis of the operations required to create this entity.