Package com.github.workerframework.api
Interface DataStore
- All Known Subinterfaces:
ManagedDataStore
- All Known Implementing Classes:
FileSystemDataStore
,HttpDataStore
,InMemoryDataStore
,S3DataStore
public interface DataStore
A representation of a generic data store, for reading and writing data typically used by workers in the course of their computation.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Delete asset identified by referenceProvide a stream to get data by referencelong
Get the byte size of some data in the DataStore by referenceStore data from a byte array.store
(InputStream dataStream, String partialReference) Store data from a stream, which should be closed by the caller.Store data from a local file.
-
Method Details
-
delete
Delete asset identified by reference- Parameters:
reference
- a complete reference to be interpreted by the DataStore implementation- Throws:
DataStoreException
- if data store cannot service the request
-
retrieve
Provide a stream to get data by reference- Parameters:
reference
- a complete reference to be interpreted by the DataStore implementation- Returns:
- the raw data referred to as a stream, which should be closed by the caller
- Throws:
DataStoreException
- if the data store cannot service the request
-
size
Get the byte size of some data in the DataStore by reference- Parameters:
reference
- a complete reference to be interpreted by the DataStore implementation- Returns:
- the size in bytes of the data being referred to
- Throws:
DataStoreException
- if the data store cannot service the request
-
store
Store data from a stream, which should be closed by the caller. The data will be stored relative to the partial reference supplied, and the absolute reference of the final location will be returned.- Parameters:
dataStream
- the stream of data which will be read and put into the DataStorepartialReference
- the partial reference, which the data will be stored relative to- Returns:
- absolute reference to the stored data, which can be used to retrieve
- Throws:
DataStoreException
- if the data store cannot service the request
-
store
Store data from a byte array. The data will be stored relative to the partial reference supplied, and the absolute reference of the final location will be returned.- Parameters:
data
- the raw byte data to storepartialReference
- the partial reference, which the data will be stored relative to- Returns:
- absolute reference to the stored data, which can be used to retrieve
- Throws:
DataStoreException
- if the data store cannot service the request
-
store
Store data from a local file. The data will be stored relative to the partial reference supplied, and the absolute reference of the final location will be returned.- Parameters:
dataPath
- path to a file on the local filesystem to store on the remote DataStorepartialReference
- the partial reference, which the data will be stored relative to- Returns:
- absolute reference to the stored data, which can be used to retrieve
- Throws:
DataStoreException
- if the data store cannot service the request
-