1 // Copyright 2010 Google Inc. All Rights Reserved.
3 package com
.google
.appengine
.api
.datastore
;
5 import com
.google
.appengine
.api
.appidentity
.AppIdentityService
;
6 import com
.google
.appengine
.api
.appidentity
.AppIdentityService
.ParsedAppId
;
7 import com
.google
.appengine
.api
.appidentity
.AppIdentityServiceFactory
;
10 * Attributes of a datastore.
13 public final class DatastoreAttributes
{
15 * Indicates the type of datastore being used.
18 public enum DatastoreType
{
24 private final DatastoreType datastoreType
;
25 private static final AppIdentityService appIdentityService
=
26 AppIdentityServiceFactory
.getAppIdentityService();
28 DatastoreAttributes() {
29 ParsedAppId identity
= appIdentityService
.parseFullAppId(DatastoreApiHelper
.getCurrentAppId());
30 datastoreType
= identity
.getPartition().isEmpty() ?
31 DatastoreType
.MASTER_SLAVE
: DatastoreType
.HIGH_REPLICATION
;
35 * Gets the datastore type.
37 * Only guaranteed to return something other than {@link
38 * DatastoreType#UNKNOWN} when running in production and querying the current
41 public DatastoreType
getDatastoreType() {