public class ZooKeeperStorage extends java.lang.Object implements TempletonStorage
TempletonStorage.Type
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
ENCODING |
java.lang.String |
job_path |
java.lang.String |
job_trackingpath |
java.lang.String |
overhead_path |
java.lang.String |
storage_root |
static java.lang.String |
TRACKINGDIR |
static java.lang.String |
ZK_HOSTS |
static java.lang.String |
ZK_SESSION_TIMEOUT |
STORAGE_CLASS, STORAGE_ROOT
Constructor and Description |
---|
ZooKeeperStorage() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close this ZK connection.
|
void |
closeStorage()
For storage methods that require a connection, this is a hint
that it's time to close the connection.
|
void |
create(TempletonStorage.Type type,
java.lang.String id)
Create a node in ZooKeeper
|
boolean |
delete(TempletonStorage.Type type,
java.lang.String id)
Delete a data grouping (all data for a jobid, all tracking data
for a job, etc.).
|
java.util.List<java.lang.String> |
getAll()
Get the id of each data grouping in the storage system.
|
java.util.List<java.lang.String> |
getAllForKey(java.lang.String key,
java.lang.String value)
Get the id of each data grouping that has the specific key/value
pair.
|
java.util.List<java.lang.String> |
getAllForType(TempletonStorage.Type type)
Get the id of each data grouping of a given type in the storage
system.
|
java.util.List<java.lang.String> |
getAllForTypeAndKey(TempletonStorage.Type type,
java.lang.String key,
java.lang.String value)
Get the id of each data grouping of a given type that has the
specific key/value pair.
|
java.lang.String |
getField(TempletonStorage.Type type,
java.lang.String id,
java.lang.String key)
Get the value of one field for a given data type.
|
java.util.Map<java.lang.String,java.lang.String> |
getFields(TempletonStorage.Type type,
java.lang.String id)
Get all the name/value pairs stored for this id.
|
java.lang.String |
getPath(TempletonStorage.Type type)
Get the path based on the job type.
|
static java.lang.String[] |
getPaths(java.lang.String fullpath) |
java.lang.String |
makeFieldZnode(TempletonStorage.Type type,
java.lang.String id,
java.lang.String name)
Make a ZK path to the named field.
|
java.lang.String |
makeZnode(TempletonStorage.Type type,
java.lang.String id)
Make a ZK path to job
|
void |
openStorage(Configuration config)
For storage methods that require a connection, this is a hint
that it's time to open a connection.
|
void |
saveField(TempletonStorage.Type type,
java.lang.String id,
java.lang.String key,
java.lang.String val)
Save a single key/value pair for a specific job id.
|
void |
startCleanup(Configuration config)
Start the cleanup process for this storage type.
|
static org.apache.zookeeper.ZooKeeper |
zkOpen(Configuration conf)
Open a ZooKeeper connection for the JobState.
|
static org.apache.zookeeper.ZooKeeper |
zkOpen(java.lang.String zkHosts,
int zkSessionTimeout)
Open a ZooKeeper connection for the JobState.
|
public static final java.lang.String TRACKINGDIR
public java.lang.String storage_root
public java.lang.String job_path
public java.lang.String job_trackingpath
public java.lang.String overhead_path
public static final java.lang.String ZK_HOSTS
public static final java.lang.String ZK_SESSION_TIMEOUT
public static final java.lang.String ENCODING
public static org.apache.zookeeper.ZooKeeper zkOpen(java.lang.String zkHosts, int zkSessionTimeout) throws java.io.IOException
java.io.IOException
public static org.apache.zookeeper.ZooKeeper zkOpen(Configuration conf) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
java.io.IOException
public void startCleanup(Configuration config)
TempletonStorage
startCleanup
in interface TempletonStorage
public void create(TempletonStorage.Type type, java.lang.String id) throws java.io.IOException
java.io.IOException
public java.lang.String getPath(TempletonStorage.Type type)
type
- public static java.lang.String[] getPaths(java.lang.String fullpath)
public java.lang.String makeFieldZnode(TempletonStorage.Type type, java.lang.String id, java.lang.String name)
public java.lang.String makeZnode(TempletonStorage.Type type, java.lang.String id)
public void saveField(TempletonStorage.Type type, java.lang.String id, java.lang.String key, java.lang.String val) throws NotFoundException
TempletonStorage
saveField
in interface TempletonStorage
type
- The data type (as listed above)id
- The String id of this data grouping (jobid, etc.)key
- The name of the field to saveval
- The value of the field to saveNotFoundException
public java.lang.String getField(TempletonStorage.Type type, java.lang.String id, java.lang.String key)
TempletonStorage
getField
in interface TempletonStorage
type
- The data type (as listed above)id
- The String id of this data grouping (jobid, etc.)key
- The name of the field to retrievepublic java.util.Map<java.lang.String,java.lang.String> getFields(TempletonStorage.Type type, java.lang.String id)
TempletonStorage
getFields
in interface TempletonStorage
type
- The data type (as listed above)id
- The String id of this data grouping (jobid, etc.)public boolean delete(TempletonStorage.Type type, java.lang.String id) throws NotFoundException
TempletonStorage
delete
in interface TempletonStorage
type
- The data type (as listed above)id
- The String id of this data grouping (jobid, etc.)NotFoundException
public java.util.List<java.lang.String> getAll()
TempletonStorage
getAll
in interface TempletonStorage
public java.util.List<java.lang.String> getAllForType(TempletonStorage.Type type)
TempletonStorage
getAllForType
in interface TempletonStorage
type
- The data type (as listed above)public java.util.List<java.lang.String> getAllForKey(java.lang.String key, java.lang.String value)
TempletonStorage
getAllForKey
in interface TempletonStorage
key
- The name of the field to search forvalue
- The value of the field to search forpublic java.util.List<java.lang.String> getAllForTypeAndKey(TempletonStorage.Type type, java.lang.String key, java.lang.String value)
TempletonStorage
getAllForTypeAndKey
in interface TempletonStorage
type
- The data type (as listed above)key
- The name of the field to search forvalue
- The value of the field to search forpublic void openStorage(Configuration config) throws java.io.IOException
TempletonStorage
openStorage
in interface TempletonStorage
java.io.IOException
public void closeStorage() throws java.io.IOException
TempletonStorage
closeStorage
in interface TempletonStorage
java.io.IOException
Copyright © 2012 The Apache Software Foundation