protected class AbstractResourceManagerTestCase.MockFederation extends Object implements IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
ResourceManager
during the unit tests.Modifier | Constructor and Description |
---|---|
protected |
AbstractResourceManagerTestCase.MockFederation() |
Modifier and Type | Method and Description |
---|---|
ScheduledFuture<?> |
addScheduledTask(Runnable task,
long initialDelay,
long delay,
TimeUnit unit)
Adds a task which will run until canceled, until it throws an exception,
or until the service is shutdown.
|
void |
destroy()
Destroys all discovered services belonging to the federation and their
persistent data and disconnects from the federation.
|
void |
didStart()
Invoked by the
AbstractFederation once the deferred startup tasks
are executed. |
void |
dropIndex(String name)
Drop a scale-out index.
|
IDataService |
getAnyDataService()
Return ANY
IDataService which has been (or could be) discovered
and which is part of the connected federation. |
IBigdataClient |
getClient()
Return the client object that was used to connect to the federation.
|
boolean |
getCollectPlatformStatistics()
true iff performance counters will be collected for the
platform on which the client is running. |
boolean |
getCollectQueueStatistics()
true iff statistics will be collected for work queues. |
CounterSet |
getCounters()
The
CounterSet which the client will use report its statistics to
the ILoadBalancerService . |
IDataService |
getDataService(UUID serviceUUID)
Resolve the service identifier to an
IDataService . |
IDataService |
getDataServiceByName(String name)
Return an
IDataService joined with this
IBigdataFederation and having the specified service name. |
IDataService[] |
getDataServices(UUID[] uuid)
Return an array of
IDataService references that is correlated
with the given array of IDataService UUID s. |
UUID[] |
getDataServiceUUIDs(int maxCount)
Return an array UUIDs for
IDataService s. |
ExecutorService |
getExecutorService()
A thread pool that may be used by clients to parallelize operations
against the federation.
|
BigdataFileSystem |
getGlobalFileSystem()
Return the global file system used to store block-structured files and
their metadata and as a source and sink for map/reduce processing.
|
SparseRowStore |
getGlobalRowStore()
Return an unisolated view of the global
SparseRowStore used to
store named property sets. |
SparseRowStore |
getGlobalRowStore(long timestamp)
Return a view of the global
SparseRowStore used to store named
property sets as of the specified timestamp. |
CounterSet |
getHostCounterSet()
The node in
IBigdataFederation.getCounters() corresponding to the root of the
host on which the client or service is executing. |
int |
getHttpdPort()
The port on which the optional httpd service will be run.
|
String |
getHttpdURL()
The URL that may be used to access the local httpd service for this
client or service.
|
IClientIndex |
getIndex(String name,
long timestamp)
Obtain a view on a partitioned index.
|
IKeyBuilder |
getKeyBuilder() |
long |
getLastCommitTime()
Return the last commit time for the federation (the timestamp of the most
recent commit point across all
IDataService s). |
ILoadBalancerService |
getLoadBalancerService()
Return the load balancer service (or a proxy for that service).
|
IMetadataIndex |
getMetadataIndex(String name,
long timestamp)
Return a read-only view of the index partitions for the named scale-out
index.
|
IMetadataService |
getMetadataService()
Return the metadata service (or a proxy for the metadata service).
|
IResourceLocator |
getResourceLocator()
Return the default locator for resources that are logical index
containers (relations and relation containers).
|
IResourceLockService |
getResourceLockService()
The service that may be used to acquire synchronous distributed locks
without deadlock detection.
|
AbstractResourceManagerTestCase.MockMetadataService |
getService()
Return the client or service.
|
String |
getServiceCounterPathPrefix()
The path prefix under which all of the client or service's counters are
located.
|
CounterSet |
getServiceCounterSet()
The node in
IBigdataFederation.getCounters() corresponding to the root of the
client or service connected using this federation. |
Class |
getServiceIface()
Return the class or interface that is the most interesting facet of the
client and which will be used to identify this client in the performance
counters reported to the
ILoadBalancerService . |
String |
getServiceName()
Return a name for the service.
|
UUID |
getServiceUUID()
|
TemporaryStore |
getTempStore()
A factory for
TemporaryStore s. |
ITransactionService |
getTransactionService()
Return the
ITransactionService (or a proxy for that service). |
Iterator<String> |
indexNameScan(String prefix,
long timestamp)
Iterator visits the names of all indices spanned by the given prefix.
|
boolean |
isDistributed()
Return
true iff the federation is distributed (uses RMI and
is running, at least in principle, across more than one host/JVM). |
boolean |
isGroupCommit()
Return true if the index manager supports group commit semantics.
|
boolean |
isJiniFederation()
Convenience method to return whether the Federation is a Jini Federation.
|
boolean |
isScaleOut()
Return
true iff the federation supports scale-out indices
(supports key-range partitioned indices). |
boolean |
isServiceReady()
Return
true iff the service is ready to start. |
boolean |
isStable()
Return
true iff the federation is backed by "stable" (vs
transient) storage. |
AbstractHTTPD |
newHttpd(int httpdPort,
ICounterSetAccess access)
Create a new
AbstractHTTPD instance. |
void |
reattachDynamicCounters()
Offers the service an opportunity to dynamically detach and re-attach
performance counters.
|
void |
registerIndex(IndexMetadata metadata)
Register a scale-out index.
|
UUID |
registerIndex(IndexMetadata metadata,
byte[][] separatorKeys,
UUID[] dataServiceUUIDs)
Register and statically partition a scale-out index.
|
UUID |
registerIndex(IndexMetadata metadata,
UUID dataServiceUUID)
Register a scale-out index and assign the initial index partition to the
specified data service.
|
void |
serviceJoin(IService service,
UUID serviceUUID)
Notice that the service has been discovered.
|
void |
serviceLeave(UUID serviceUUID)
Notice that the service is no longer available.
|
protected AbstractResourceManagerTestCase.MockFederation()
public AbstractResourceManagerTestCase.MockMetadataService getService()
IFederationDelegate
getService
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
public void destroy()
IBigdataFederation
destroy
in interface IIndexStore
destroy
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
public void dropIndex(String name)
IBigdataFederation
dropIndex
in interface IGISTManager
dropIndex
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
name
- The index name.public IDataService getAnyDataService()
IBigdataFederation
IDataService
which has been (or could be) discovered
and which is part of the connected federation.
Note: This method is here as a failsafe when the
ILoadBalancerService
is not available.
getAnyDataService
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
null
if there are NO known IDataService
s.public IBigdataClient getClient()
IBigdataFederation
getClient
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
public String getServiceCounterPathPrefix()
IBigdataFederation
ICounterSet.pathSeparator
.getServiceCounterPathPrefix
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
IBigdataFederation.getServiceCounterSet()
public CounterSet getCounters()
IBigdataFederation
CounterSet
which the client will use report its statistics to
the ILoadBalancerService
.
Note: Applications MAY add their own counters (within a suitable
namespace) to the returned CounterSet
in order to report their
own performance data to the ILoadBalancerService
.
getCounters
in interface ICounterSetAccess
getCounters
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
IBigdataFederation.getServiceCounterSet()
,
IBigdataFederation.getServiceCounterPathPrefix()
public IDataService getDataService(UUID serviceUUID)
IBigdataFederation
IDataService
.
Note: Whether the returned object is a proxy or the service implementation depends on whether the federation is embedded (in process) or distributed (networked).
getDataService
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
serviceUUID
- The identifier for a IDataService
.IDataService
or null
iff the
IDataService
could not be discovered from its identifier.public UUID[] getDataServiceUUIDs(int maxCount)
IBigdataFederation
IDataService
s.getDataServiceUUIDs
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
maxCount
- The maximum #of data services whose UUIDs will be returned.
When zero (0) the UUID for all known data services will be
returned.UUID
s for data services.public ExecutorService getExecutorService()
IBigdataFederation
ClientIndexView
.getExecutorService
in interface IIndexStore
getExecutorService
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
public SparseRowStore getGlobalRowStore()
IIndexStore
SparseRowStore
used to
store named property sets.getGlobalRowStore
in interface IIndexStore
GlobalRowStoreSchema
public SparseRowStore getGlobalRowStore(long timestamp)
IIndexStore
SparseRowStore
used to store named
property sets as of the specified timestamp.
The SparseRowStore
only permits ITx.UNISOLATED
writes, so
you MUST specify ITx.UNISOLATED
as the timestamp if you intend to
write on the global row store!
You can request the most recent committed state of the global row store
by specifying ITx.READ_COMMITTED
.
getGlobalRowStore
in interface IIndexStore
timestamp
- The timestamp of the view.null
if no view
exists as of that timestamp.public IClientIndex getIndex(String name, long timestamp)
IBigdataFederation
getIndex
in interface IIndexManager
getIndex
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
name
- The index name.timestamp
- A transaction identifier, ITx.UNISOLATED
for the
unisolated index view, ITx.READ_COMMITTED
, or
timestamp
for a historical view no later than
the specified timestamp.null
if the index does not exist.IGISTLocalManager.getIndexLocal(String, long)
public IKeyBuilder getKeyBuilder()
public ILoadBalancerService getLoadBalancerService()
IBigdataFederation
getLoadBalancerService
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
null
if the service has not been discovered.public IMetadataIndex getMetadataIndex(String name, long timestamp)
IBigdataFederation
getMetadataIndex
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
name
- The name of the scale-out index.IMetadataIndex
for the named scale-out index -or-
null
iff there is no such scale-out index.public IMetadataService getMetadataService()
IBigdataFederation
getMetadataService
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
null
if the service has not been discovered.public ITransactionService getTransactionService()
IBigdataFederation
ITransactionService
(or a proxy for that service).getTransactionService
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
null
if the service has not been
discovered.public boolean isDistributed()
IBigdataFederation
true
iff the federation is distributed (uses RMI and
is running, at least in principle, across more than one host/JVM).isDistributed
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
public boolean isScaleOut()
IBigdataFederation
true
iff the federation supports scale-out indices
(supports key-range partitioned indices). Note that a true
return does NOT imply that the federation is running in a distributed
environment, just that it uses the scale-out index architecture. A
false
return indicates that IBigdataFederation.getMetadataService()
WILL NOT return a IMetadataService
since key-range partitioned
indices are NOT supported.isScaleOut
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
IndexMetadata
public boolean isStable()
IBigdataFederation
true
iff the federation is backed by "stable" (vs
transient) storage. Most federation deployments are stable in this sense,
but it is possible to create federation instances backed solely by
transient storage and those instances will report false
here. This is most typically done for testing purposes using a
LocalDataServiceFederation
or an EmbeddedFederation
.isStable
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
public boolean isGroupCommit()
IIndexManager
isGroupCommit
in interface IIndexManager
(NSS GROUP COMMIT)
public long getLastCommitTime()
IBigdataFederation
IDataService
s).
This is useful for ITx.READ_COMMITTED
operations that need to use
a consistent timestamp across a series of DataService
s or a
series of requests against a single DataService
that must use a
consistent view.
getLastCommitTime
in interface IIndexStore
getLastCommitTime
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
IRootBlockView.getLastCommitTime()
public void registerIndex(IndexMetadata metadata)
IBigdataFederation
registerIndex
in interface IGISTManager
registerIndex
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
metadata
- The metadata template used to create component indices for
BTree
s this scale-out index (this also specifies the
name of the scale-out index).IGISTLocalManager.getIndexLocal(String, long)
public UUID registerIndex(IndexMetadata metadata, UUID dataServiceUUID)
IBigdataFederation
registerIndex
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
metadata
- The metadata template used to create component indices for
BTree
s this scale-out index (this also specifies the
name of the scale-out index).dataServiceUUID
- The data service identifier (optional). When null
,
a data service will be selected automatically. If
IndexMetadata.Options#INITIAL_DATA_SERVICE
was
specified, then the identified service will be used. Otherwise
an underutilized service will be selected using the
ILoadBalancerService
.IndexMetadata.Options#INITIAL_DATA_SERVICE
public UUID registerIndex(IndexMetadata metadata, byte[][] separatorKeys, UUID[] dataServiceUUIDs)
IBigdataFederation
registerIndex
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
metadata
- The metadata template used to create component indices for
BTree
s this scale-out index (this also specifies the
name of the scale-out index).separatorKeys
- The array of separator keys. Each separator key is interpreted
as an unsigned byte[]. The first entry MUST be an
empty byte[]. The entries MUST be in sorted order.dataServiceUUIDs
- The array of data services onto which each partition defined
by a separator key will be mapped (optional). When given, the
#of entries in this array MUST agree with the #of entries in
the separatorKeys array and all entries must be non-null
.
When not given, the index partitions will be auto-assigned to
the discovered data services.public IResourceLocator getResourceLocator()
IIndexStore
getResourceLocator
in interface IIndexStore
public IResourceLockService getResourceLockService()
IIndexStore
getResourceLockService
in interface IIndexStore
public BigdataFileSystem getGlobalFileSystem()
IIndexStore
getGlobalFileSystem
in interface IIndexStore
BigdataFileSystem
public TemporaryStore getTempStore()
IIndexStore
TemporaryStore
s. TemporaryStore
s are
thread-safe and may be used by multiple processes at once. Old
TemporaryStore
s are eventually retired by the factory and their
storage is reclaimed once they are finalized (after they are no longer in
use by any process). The decision to retire a TemporaryStore
is
either made implicitly, when it is no longer weakly reachable, or
explicitly, when it has grown large enough that no new processes should
begin using that TemporaryStore
. In the latter case, the
TemporaryStore
will remain available to the process(es) using it
and a new TemporaryStore
will be allocated and made available to
the caller.
It is important that processes do not hold a hard reference to a
TemporaryStore
beyond the end of the process as that will prevent
the TemporaryStore
from being finalized. Holding reference to an
AbstractBTree
created on a TemporaryStore
is equivalent
to holding a hard reference to the TemporaryStore
itself since
the AbstractBTree
holds onto the backing IRawStore
using
a hard reference.
getTempStore
in interface IIndexStore
TemporaryStore
.public String getHttpdURL()
IBigdataFederation
getHttpdURL
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
null
if the httpd service is not
running.public CounterSet getServiceCounterSet()
IBigdataFederation
IBigdataFederation.getCounters()
corresponding to the root of the
client or service connected using this federation.getServiceCounterSet
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
public IDataService getDataServiceByName(String name)
IBigdataFederation
IDataService
joined with this
IBigdataFederation
and having the specified service name.
Services that are not joined will not be discovered.
Note: At least some service fabrics (such as jini) do not enforce a
uniqueness constraint on the service name(s). In such cases an arbitrary
IDataService
method the other requirements will be returned. It
is the responsibility of the administrator to ensure that each
IDataService
is assigned a distinct service name.
getDataServiceByName
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
name
- The service name.null
if none is
joined with the IBigdataFederation
at this time.public IDataService[] getDataServices(UUID[] uuid)
IBigdataFederation
IDataService
references that is correlated
with the given array of IDataService
UUID
s.
Note: This method will also resolve the UUID
of an
IMetadataService
.
getDataServices
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
public void didStart()
IFederationDelegate
AbstractFederation
once the deferred startup tasks
are executed. Services may use this event to perform additional
initialization.didStart
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
public Class getServiceIface()
IFederationDelegate
ILoadBalancerService
.getServiceIface
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
null
.public String getServiceName()
IFederationDelegate
getServiceName
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
public UUID getServiceUUID()
IFederationDelegate
getServiceUUID
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
AbstractService.setServiceUUID(UUID)
public boolean isServiceReady()
IFederationDelegate
true
iff the service is ready to start.isServiceReady
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
public AbstractHTTPD newHttpd(int httpdPort, ICounterSetAccess access) throws IOException
IFederationDelegate
AbstractHTTPD
instance.newHttpd
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
access
- Used to materialize the CounterSet
that will be served
up.IOException
public void reattachDynamicCounters()
IFederationDelegate
ILoadBalancerService
. In general, implementations should limit
the frequency of update, e.g., to no more than once a second.
Note: For most purposes, this has been replaced by
ICounterSetAccess
which is now passed into
CounterSetHTTPD
. That provides the necessary indirection for
periodic refresh of the performance counters. The CounterSetHTTPD
now also handles the limitation on the update frequency for the
materialized counters.
However, there are still some counters which need to be dynamically reattached. For example, any counter set which is dynamic in its structure, such as the DirectBufferPool.
reattachDynamicCounters
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
public void serviceJoin(IService service, UUID serviceUUID)
IFederationDelegate
IBigdataClient
.serviceJoin
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
service
- The service.serviceUUID
- The service UUID
.public void serviceLeave(UUID serviceUUID)
IFederationDelegate
IBigdataClient
when the service is no
longer available from any of its service registrars.serviceLeave
in interface IFederationDelegate<AbstractResourceManagerTestCase.MockMetadataService>
serviceUUID
- The service UUID
.public CounterSet getHostCounterSet()
IBigdataFederation
IBigdataFederation.getCounters()
corresponding to the root of the
host on which the client or service is executing.getHostCounterSet
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
public ScheduledFuture<?> addScheduledTask(Runnable task, long initialDelay, long delay, TimeUnit unit)
IIndexStore
addScheduledTask
in interface IIndexStore
task
- The task.initialDelay
- The initial delay.delay
- The delay between invocations.unit
- The units for the delay parameters.ScheduledFuture
for that task.public boolean getCollectPlatformStatistics()
IIndexStore
true
iff performance counters will be collected for the
platform on which the client is running.getCollectPlatformStatistics
in interface IIndexStore
public boolean getCollectQueueStatistics()
IIndexStore
true
iff statistics will be collected for work queues.getCollectQueueStatistics
in interface IIndexStore
public int getHttpdPort()
IIndexStore
getHttpdPort
in interface IIndexStore
public Iterator<String> indexNameScan(String prefix, long timestamp)
IGISTManager
indexNameScan
in interface IGISTManager
prefix
- The prefix (optional). When given, this MUST include a
.
if you want to restrict the scan to only those
indices in a given namespace. Otherwise you can find indices
in kb2
if you provide the prefix kb
where both kb and kb2 are namespaces since the indices spanned
by kb
would include both kb.xyz
and
kb2.xyx
.timestamp
- A timestamp which represents either a possible commit time on
the store or a read-only transaction identifier.public boolean isJiniFederation()
IBigdataFederation
isJiniFederation
in interface IBigdataFederation<AbstractResourceManagerTestCase.MockMetadataService>
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.