edu.isi.pegasus.planner.catalog.replica.impl
public class FlushedCache extends Object implements ReplicaCatalog
Modifier and Type | Field and Description |
---|---|
private static int |
m_avg_line_size
No.
|
private int |
m_buffer_size
No.
|
private int |
m_line_count
No.
|
protected BufferedWriter |
m_out
A buffered writer, to buffer all file writes being performed.
|
BATCH_KEY, c_prefix, DB_PREFIX, PROXY_KEY
DB_ALL_PREFIX
Constructor and Description |
---|
FlushedCache() |
Modifier and Type | Method and Description |
---|---|
int |
clear()
Removes everything.
|
void |
close()
This operation will dump the in-memory representation back onto disk.
|
boolean |
connect(Properties props)
Establishes a connection to the database from the properties.
|
boolean |
connect(String filename)
Opens the file for writing.
|
int |
delete(Map x,
boolean matchAttributes)
Deletes multiple mappings into the replica catalog.
|
int |
delete(String lfn,
ReplicaCatalogEntry tuple)
Deletes a very specific mapping from the replica catalog.
|
int |
delete(String lfn,
String pfn)
Deletes a specific mapping from the replica catalog.
|
int |
delete(String lfn,
String name,
Object value)
Deletes all PFN entries for a given LFN from the replica catalog
where the PFN attribute is found, and matches exactly the object
value.
|
int |
deleteByResource(String lfn,
String handle)
Deletes all PFN entries for a given LFN from the replica catalog
where the resource handle is found.
|
private void |
flush()
Check if the buffer is full i.e.
|
int |
insert(Map x)
Inserts multiple mappings into the replica catalog.
|
int |
insert(String lfn,
ReplicaCatalogEntry tuple)
Inserts a new mapping into the replica catalog.
|
int |
insert(String lfn,
String pfn,
String handle)
Inserts a new mapping into the replica catalog.
|
boolean |
isClosed()
Predicate to check, if the connection with the catalog's implementation
is still active.
|
Set |
list()
Lists all logical filenames in the catalog.
|
Set |
list(String constraint)
Lists a subset of all logical filenames in the catalog.
|
Map |
lookup(Map constraints)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
Map |
lookup(Set lfns)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
Map |
lookup(Set lfns,
String handle)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
Collection |
lookup(String lfn)
Retrieves all entries for a given LFN from the replica catalog.
|
String |
lookup(String lfn,
String handle)
Retrieves the entry for a given filename and resource handle from
the replica catalog.
|
Map |
lookupNoAttributes(Set lfns)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
Map |
lookupNoAttributes(Set lfns,
String handle)
Retrieves multiple entries for a given logical filename, up to the
complete catalog.
|
Set |
lookupNoAttributes(String lfn)
Retrieves all entries for a given LFN from the replica catalog.
|
String |
quote(Escape e,
String s)
Quotes a string only if necessary.
|
int |
remove(Set lfns)
Removes all mappings for a set of LFNs.
|
int |
remove(String lfn)
Removes all mappings for an LFN from the replica catalog.
|
int |
removeByAttribute(String handle)
Removes all entries associated with a particular resource handle.
|
int |
removeByAttribute(String name,
Object value)
Removes all entries from the replica catalog where the PFN attribute
is found, and matches exactly the object value.
|
void |
setBufferSize(int bufferSize)
Set buffer size i.e.
|
private void |
write(String content) |
protected String |
writeReplicaCatalogEntry(String lfn,
ReplicaCatalogEntry rce)
The method generate a String representation of the replica catalog entry.
|
protected BufferedWriter m_out
private int m_buffer_size
private static final int m_avg_line_size
private int m_line_count
public void setBufferSize(int bufferSize)
public boolean connect(String filename)
filename
- is the name of the file to write too.public boolean connect(Properties props)
public String quote(Escape e, String s)
However, if the property "quote" had a true
value when
connecting to the database, output will always be quoted.
e
- is the Escape instance used to escape strings.s
- is the string that may require quotingprotected String writeReplicaCatalogEntry(String lfn, ReplicaCatalogEntry rce)
lfn
- The logical file namerce
- The replica catalog entry consisting of the physical file name
name and key, value pairs.private void flush()
setBufferSize
public void close()
public boolean isClosed()
close()
.public String lookup(String lfn, String handle)
ReplicaCatalog
lookup
in interface ReplicaCatalog
lfn
- is the logical filename to obtain information for.handle
- is the resource handle to obtain entries for.null
if no match was found.public Collection lookup(String lfn)
ReplicaCatalog
lookup
in interface ReplicaCatalog
lfn
- is the logical filename to obtain information for.ReplicaCatalogEntry
public Set lookupNoAttributes(String lfn)
ReplicaCatalog
lookupNoAttributes
in interface ReplicaCatalog
lfn
- is the logical filename to obtain information for.public Map lookup(Set lfns)
ReplicaCatalog
lookup
in interface ReplicaCatalog
lfns
- is a set of logical filename strings to look up.ReplicaCatalogEntry
public Map lookupNoAttributes(Set lfns)
ReplicaCatalog
lookupNoAttributes
in interface ReplicaCatalog
lfns
- is a set of logical filename strings to look up.public Map lookup(Set lfns, String handle)
ReplicaCatalog
lookup
in interface ReplicaCatalog
lfns
- is a set of logical filename strings to look up.handle
- is the resource handle, restricting the LFNs.ReplicaCatalogEntry
public Map lookupNoAttributes(Set lfns, String handle)
ReplicaCatalog
lookupNoAttributes
in interface ReplicaCatalog
lfns
- is a set of logical filename strings to look up.handle
- is the resource handle, restricting the LFNs.public Map lookup(Map constraints)
ReplicaCatalog
lookup
in interface ReplicaCatalog
constraints
- is mapping of keys 'lfn', 'pfn', or any
attribute name, e.g. the resource handle 'site', to a string that
has some meaning to the implementing system. This can be a SQL
wildcard for queries, or a regular expression for Java-based memory
collections. Unknown keys are ignored. Using an empty map requests
the complete catalog.ReplicaCatalogEntry
public Set list()
ReplicaCatalog
list
in interface ReplicaCatalog
public Set list(String constraint)
ReplicaCatalog
list
in interface ReplicaCatalog
constraint
- is a constraint for the logical filename only. It
is a string that has some meaning to the implementing system. This
can be a SQL wildcard for queries, or a regular expression for
Java-based memory collections.public int insert(String lfn, ReplicaCatalogEntry tuple)
insert
in interface ReplicaCatalog
lfn
- is the logical filename under which to book the entry.tuple
- is the physical filename and associated PFN attributes.public int insert(String lfn, String pfn, String handle)
ReplicaCatalogEntry
element will be constructed, and passed
to the appropriate insert function.insert
in interface ReplicaCatalog
lfn
- is the logical filename under which to book the entry.pfn
- is the physical filename associated with it.handle
- is a resource handle where the PFN resides.insert(String, ReplicaCatalogEntry )
,
ReplicaCatalogEntry
public int insert(Map x)
insert
in interface ReplicaCatalog
x
- is a map from logical filename string to list of replica
catalog entries.org.griphyn.common.catalog.ReplicaCatalogEntry
private void write(String content)
public int delete(String lfn, String pfn)
ReplicaCatalog
delete
in interface ReplicaCatalog
lfn
- is the logical filename in the tuple.pfn
- is the physical filename in the tuple.public int delete(Map x, boolean matchAttributes)
ReplicaCatalog
delete
in interface ReplicaCatalog
x
- is a map from logical filename string to list of
replica catalog entries.matchAttributes
- whether mapping should be deleted only if all
attributes match.ReplicaCatalogEntry
public int delete(String lfn, ReplicaCatalogEntry tuple)
ReplicaCatalog
delete
in interface ReplicaCatalog
lfn
- is the logical filename in the tuple.tuple
- is a description of the PFN and its attributes.public int delete(String lfn, String name, Object value)
ReplicaCatalog
delete
in interface ReplicaCatalog
lfn
- is the logical filename to look for.name
- is the PFN attribute name to look for.value
- is an exact match of the attribute value to match.public int deleteByResource(String lfn, String handle)
ReplicaCatalog
delete( lfn, RESOURCE_HANDLE, handle )
deleteByResource
in interface ReplicaCatalog
lfn
- is the logical filename to look for.handle
- is the resource handlepublic int remove(String lfn)
ReplicaCatalog
remove
in interface ReplicaCatalog
lfn
- is the logical filename to remove all mappings for.public int remove(Set lfns)
ReplicaCatalog
remove
in interface ReplicaCatalog
lfns
- is a set of logical filename to remove all mappings for.public int removeByAttribute(String name, Object value)
ReplicaCatalog
removeByAttribute
in interface ReplicaCatalog
name
- is the PFN attribute name to look for.value
- is an exact match of the attribute value to match.public int removeByAttribute(String handle)
ReplicaCatalog
removeByAttribute
method.removeByAttribute
in interface ReplicaCatalog
handle
- is the site handle to remove all entries for.ReplicaCatalog.removeByAttribute( String, Object )
public int clear()
ReplicaCatalog
clear
in interface ReplicaCatalog