com.google.appengine.api.datastore.dev
Class LocalDatastoreService
- java.lang.Object
-
- com.google.appengine.api.datastore.dev.LocalDatastoreService
-
- Direct Known Subclasses:
- LocalDatastoreV3Service
public abstract class LocalDatastoreService extends java.lang.Object
A local implementation of the Datastore.This is a memory-based implementation which can persist itself to disk through a batch operation.
This class is no longer a
com.google.appengine.tools.development.LocalRpcService
, however it is still called a service for backwards compatibility.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static class
LocalDatastoreService.AutoIdAllocationPolicy
The set of supported values for autoIdAllocationPolicy, which controls how auto IDs are assigned by put().
-
Field Summary
Fields Modifier and Type Field and Description static java.lang.String
AUTO_ID_ALLOCATION_POLICY_PROPERTY
static java.lang.String
BACKING_STORE_PROPERTY
Where to read/store the datastore from/to.static java.lang.String
EMULATE_VNEXT_FEATURES
True to emulate Datastore vnext features.static java.lang.String
FORCE_IS_HIGH_REP_PROPERTY
If this property exists we consider the datastore to be high replication independent of the high rep job policy.static java.lang.String
HIGH_REP_JOB_POLICY_CLASS_PROPERTY
The fully-qualifed name of a class that implementsHighRepJobPolicy
and has a no-arg constructor.static java.lang.String
INDEX_CONFIGURATION_FORMAT_PROPERTY
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 int
MAX_QUERY_RESULTS
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 writingcom.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
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method and Description protected abstract void
addActionImpl(TaskQueueAddRequest action)
Calls the add method on the taskqueue service.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)
void
enableScatterProperty(boolean enable)
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(java.io.File appDirectory, Clock clock, java.util.Map<java.lang.String,java.lang.String> properties)
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)
-
-
-
Field Detail
-
MAX_QUERY_RESULTS
public static final int MAX_QUERY_RESULTS
- See Also:
- Constant Field Values
-
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
-
EMULATE_VNEXT_FEATURES
public static final java.lang.String EMULATE_VNEXT_FEATURES
True to emulate Datastore vnext features. These features mandate strong consistency everywhere, so customHighRepJobPolicy
policies are disallowed while this flag is true.- 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 writingcom.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 implementsHighRepJobPolicy
and has a no-arg constructor. If not provided we use aDefaultHighRepJobPolicy
. See the javadoc for this class for information on its configurable properties.- See Also:
- Constant Field Values
-
FORCE_IS_HIGH_REP_PROPERTY
public static final java.lang.String FORCE_IS_HIGH_REP_PROPERTY
If this property exists we consider the datastore to be high replication independent of the high rep job policy.- See Also:
- Constant Field Values
-
INDEX_CONFIGURATION_FORMAT_PROPERTY
public static final java.lang.String INDEX_CONFIGURATION_FORMAT_PROPERTY
- See Also:
- Constant Field Values
-
AUTO_ID_ALLOCATION_POLICY_PROPERTY
public static final java.lang.String AUTO_ID_ALLOCATION_POLICY_PROPERTY
- See Also:
- Constant Field Values
-
-
Method Detail
-
addActionImpl
protected abstract void addActionImpl(TaskQueueAddRequest action)
Calls the add method on the taskqueue service.Subclasses should override this to use the appropriate method of calling other services.
-
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)
-
init
public void init(java.io.File appDirectory, Clock clock, 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)
-
enableScatterProperty
public void enableScatterProperty(boolean enable)
-
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.
-
-