com.intel.cosbench.api.storage
Interface StorageAPI

All Known Implementing Classes:
AmpliStorage, NoneStorage, SwiftStorage

public interface StorageAPI


Method Summary
 void createContainer(java.lang.String container, Config config)
          create a container.
 void createObject(java.lang.String container, java.lang.String object, java.io.InputStream data, long length, Config config)
          upload an object into a container.
 void deleteContainer(java.lang.String container, Config config)
          delete a container.
 void deleteObject(java.lang.String container, java.lang.String object, Config config)
          delete an object.
 void dispose()
          clean up Storage API.
 java.io.InputStream getObject(java.lang.String container, java.lang.String object, Config config)
          download an object from a container.
 Context getParms()
          retrieve parameters and current settings used by the StorageAPI.
 void init(Config config, Logger logger)
          initialize Storage API with parameters contained in config, the parameter list depends on storage type.
 void setAuthContext(AuthContext info)
          associate authentication context with Storage API for further storage operations.
 

Method Detail

init

void init(Config config,
          Logger logger)
initialize Storage API with parameters contained in config, the parameter list depends on storage type.

Parameters:
config - - one instance from “com.intel.cosbench.config.Config” class, which includes parameters for authentication.
logger - - one instance from “com.intel.cosbench.log.Logger” class, which delivers logging capabilities to Auth API.

dispose

void dispose()
clean up Storage API.


getParms

Context getParms()
retrieve parameters and current settings used by the StorageAPI.

Returns:
Context - one Context instance which contains all parameters configured for the storage.

setAuthContext

void setAuthContext(AuthContext info)
associate authentication context with Storage API for further storage operations.

Parameters:
info - - one AuthContext instance, normally, it's the return from login() in Auth API.
logger - - one instance from “com.intel.cosbench.log.Logger” class, which delivers logging capabilities to Auth API.

getObject

java.io.InputStream getObject(java.lang.String container,
                              java.lang.String object,
                              Config config)
download an object from a container.

Parameters:
container - - the name of a container.
object - - the name of an object to be downloaded.
config - - the configuration used for this operation.
Returns:
inputStream - the inputStream of the object content. If null that means the object does't exist or something bad happened.

createContainer

void createContainer(java.lang.String container,
                     Config config)
create a container.

Parameters:
container - - the name of a container.
config - - the configuration used for this operation.

createObject

void createObject(java.lang.String container,
                  java.lang.String object,
                  java.io.InputStream data,
                  long length,
                  Config config)
upload an object into a container.

Parameters:
container - - the name of a container.
object - - the name of an object to be uploaded.
data - - the inputStream of the object content.
length - - the length of object content.
config - - the configuration used for this operation.

deleteContainer

void deleteContainer(java.lang.String container,
                     Config config)
delete a container.

Parameters:
container - - the name of a container to be deleted.
config - - the configuration used for this operation.

deleteObject

void deleteObject(java.lang.String container,
                  java.lang.String object,
                  Config config)
delete an object.

Parameters:
container - - the name of a container.
object - - the name of an object to be deleted.
config - - the configuration used for this operation.