Package cz.o2.proxima.direct.core
Class DirectDataOperator
- java.lang.Object
-
- cz.o2.proxima.direct.core.DirectDataOperator
-
- All Implemented Interfaces:
DataOperator,ContextProvider,java.lang.AutoCloseable
public class DirectDataOperator extends java.lang.Object implements DataOperator, ContextProvider
DataOperatorimplementation for direct accesses.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classDirectDataOperator.DelegateDataAccessorFactory
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Close the operator and release all allocated resources.java.util.Optional<DirectAttributeFamilyDescriptor>findFamilyByName(java.lang.String name)Retrieve family by given name.java.util.Optional<DataAccessorFactory>getAccessorFactory(java.net.URI uri)Retrieve factory that first matches given uri.java.util.stream.Stream<DirectAttributeFamilyDescriptor>getAllFamilies()Retrieve all families with their direct representation.java.util.Optional<BatchLogReader>getBatchLogReader(AttributeDescriptor<?>... attrs)RetrieveCommitLogReaderfor givenAttributeDescriptors.java.util.Optional<BatchLogReader>getBatchLogReader(java.util.Collection<AttributeDescriptor<?>> attrs)RetrieveBatchLogReaderfor givenAttributeDescriptors.java.util.Optional<CachedView>getCachedView(AttributeDescriptor<?>... attrs)RetrieveCachedViewfor givenAttributeDescriptors.java.util.Optional<CachedView>getCachedView(java.util.Collection<AttributeDescriptor<?>> attrs)RetrieveCachedViewfor givenAttributeDescriptors.ClientTransactionManagergetClientTransactionManager()java.util.Optional<CommitLogReader>getCommitLogReader(AttributeDescriptor<?>... attrs)RetrieveCommitLogReaderfor givenAttributeDescriptors.java.util.Optional<CommitLogReader>getCommitLogReader(java.util.Collection<AttributeDescriptor<?>> attrs)RetrieveCommitLogReaderfor givenAttributeDescriptors.ContextgetContext()RetrieveContextthat is used in all distributed operations.java.util.Set<DirectAttributeFamilyDescriptor>getFamiliesForAttribute(AttributeDescriptor<?> desc)Resolve all direct attribute representations of given attribute.DirectAttributeFamilyDescriptorgetFamilyByName(java.lang.String name)Retrieve family by given name.TransactionalOnlineAttributeWritergetGlobalTransactionWriter()Retrieve aTransactionalOnlineAttributeWriterwith GLOBAL transactions capable to fulfil any transactional requests.java.util.Optional<RandomAccessReader>getRandomAccess(AttributeDescriptor<?>... attrs)RetrieveRandomAccessReaderfor givenAttributeDescriptors.java.util.Optional<RandomAccessReader>getRandomAccess(java.util.Collection<AttributeDescriptor<?>> attrs)RetrieveRandomAccessReaderfor givenAttributeDescriptors.RepositorygetRepository()Retrieve repository associated with the operator.ServerTransactionManagergetServerTransactionManager()java.util.Optional<OnlineAttributeWriter>getWriter(AttributeDescriptor<?> attr)Retrieve writer for givenAttributeDescriptor.voidreload()Reload the operator afterRepositoryhas been changed.java.util.Optional<DirectAttributeFamilyDescriptor>resolve(AttributeFamilyDescriptor family)Optionally convert given family to direct representation.DirectAttributeFamilyDescriptorresolveRequired(AttributeFamilyDescriptor family)Convert given core family to direct representation.DirectDataOperatorwithExecutorFactory(Factory<java.util.concurrent.ExecutorService> factory)Explicitly specifyExecutorServiceto use when constructing threads.
-
-
-
Method Detail
-
withExecutorFactory
public DirectDataOperator withExecutorFactory(Factory<java.util.concurrent.ExecutorService> factory)
Explicitly specifyExecutorServiceto use when constructing threads.- Parameters:
factory- the factory forExecutorService- Returns:
- this
-
reload
public final void reload()
Description copied from interface:DataOperatorReload the operator afterRepositoryhas been changed.This method is called automatically, when
ConfigRepository.reloadConfig(boolean, cz.o2.proxima.typesafe.config.Config)is called.- Specified by:
reloadin interfaceDataOperator
-
getContext
public Context getContext()
RetrieveContextthat is used in all distributed operations.- Specified by:
getContextin interfaceContextProvider- Returns:
- the serializable context
-
resolveRequired
public DirectAttributeFamilyDescriptor resolveRequired(AttributeFamilyDescriptor family)
Convert given core family to direct representation.- Parameters:
family- the family to convert- Returns:
- the converted family
-
resolve
public java.util.Optional<DirectAttributeFamilyDescriptor> resolve(AttributeFamilyDescriptor family)
Optionally convert given family to direct representation.- Parameters:
family- the family to convert- Returns:
- the optionally converted family
-
getAccessorFactory
public java.util.Optional<DataAccessorFactory> getAccessorFactory(java.net.URI uri)
Retrieve factory that first matches given uri.- Parameters:
uri- the URI to search factory for- Returns:
- optional
DataAccessorFactoryfor specified URI
-
getWriter
public java.util.Optional<OnlineAttributeWriter> getWriter(AttributeDescriptor<?> attr)
Retrieve writer for givenAttributeDescriptor.- Parameters:
attr- the attribute to find writer for- Returns:
- optional writer
-
getGlobalTransactionWriter
public TransactionalOnlineAttributeWriter getGlobalTransactionWriter()
Retrieve aTransactionalOnlineAttributeWriterwith GLOBAL transactions capable to fulfil any transactional requests.Note that global transactions are required to be processed by a single instance of
TransactionManagerand therefore are not scalable.Use with caution.
- Returns:
- the global
TransactionalOnlineAttributeWriterthat is able to handle all transactions
-
getCommitLogReader
public java.util.Optional<CommitLogReader> getCommitLogReader(java.util.Collection<AttributeDescriptor<?>> attrs)
RetrieveCommitLogReaderfor givenAttributeDescriptors.- Parameters:
attrs- the attributes to find commit log reader for- Returns:
- optional commit log reader
-
getCommitLogReader
@SafeVarargs public final java.util.Optional<CommitLogReader> getCommitLogReader(AttributeDescriptor<?>... attrs)
RetrieveCommitLogReaderfor givenAttributeDescriptors.- Parameters:
attrs- the attributes to find commit log reader for- Returns:
- optional commit log reader
-
getBatchLogReader
public java.util.Optional<BatchLogReader> getBatchLogReader(java.util.Collection<AttributeDescriptor<?>> attrs)
RetrieveBatchLogReaderfor givenAttributeDescriptors.- Parameters:
attrs- the attributes to find commit log reader for- Returns:
- optional batch log reader
-
getBatchLogReader
@SafeVarargs public final java.util.Optional<BatchLogReader> getBatchLogReader(AttributeDescriptor<?>... attrs)
RetrieveCommitLogReaderfor givenAttributeDescriptors.- Parameters:
attrs- the attributes to find commit log reader for- Returns:
- optional commit log reader
-
getCachedView
public java.util.Optional<CachedView> getCachedView(java.util.Collection<AttributeDescriptor<?>> attrs)
RetrieveCachedViewfor givenAttributeDescriptors.- Parameters:
attrs- the attributes to find cached view for- Returns:
- optional cached view
-
getCachedView
@SafeVarargs public final java.util.Optional<CachedView> getCachedView(AttributeDescriptor<?>... attrs)
RetrieveCachedViewfor givenAttributeDescriptors.- Parameters:
attrs- the attributes to find cached view for- Returns:
- optional cached view
-
getRandomAccess
public java.util.Optional<RandomAccessReader> getRandomAccess(java.util.Collection<AttributeDescriptor<?>> attrs)
RetrieveRandomAccessReaderfor givenAttributeDescriptors.- Parameters:
attrs- the attributes to find radom access reader for- Returns:
- optional random access reader
-
getRandomAccess
@SafeVarargs public final java.util.Optional<RandomAccessReader> getRandomAccess(AttributeDescriptor<?>... attrs)
RetrieveRandomAccessReaderfor givenAttributeDescriptors.- Parameters:
attrs- the attributes to find random access reader for- Returns:
- optional random access reader
-
close
public void close()
Close the operator and release all allocated resources.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfaceDataOperator
-
getFamiliesForAttribute
public java.util.Set<DirectAttributeFamilyDescriptor> getFamiliesForAttribute(AttributeDescriptor<?> desc)
Resolve all direct attribute representations of given attribute.- Parameters:
desc- descriptor of attribute- Returns:
- the set of all direct attribute representations
-
getAllFamilies
public java.util.stream.Stream<DirectAttributeFamilyDescriptor> getAllFamilies()
Retrieve all families with their direct representation.- Returns:
- stream of all
DirectAttributeFamilyDescriptors.
-
getFamilyByName
public DirectAttributeFamilyDescriptor getFamilyByName(java.lang.String name)
Retrieve family by given name.- Parameters:
name- name of the family to search for- Returns:
DirectAttributeFamilyDescriptorfor given family- Throws:
java.lang.IllegalArgumentException- when family not found
-
findFamilyByName
public java.util.Optional<DirectAttributeFamilyDescriptor> findFamilyByName(java.lang.String name)
Retrieve family by given name.- Parameters:
name- name of the family to search for- Returns:
OptionalofDirectAttributeFamilyDescriptorfor given family ofOptional.empty()
-
getClientTransactionManager
@Internal public ClientTransactionManager getClientTransactionManager()
- Returns:
- cached implementation of
ClientTransactionManager. Should not be called from client code.
-
getServerTransactionManager
@Internal public ServerTransactionManager getServerTransactionManager()
- Returns:
- cached implementation of
ServerTransactionManager. Should not be called from client code.
-
getRepository
public Repository getRepository()
Description copied from interface:DataOperatorRetrieve repository associated with the operator.- Specified by:
getRepositoryin interfaceDataOperator- Returns:
Repositoryassociated with the operator
-
-