public class Snapshots
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Snapshots.Order
Order enum class for the select method
|
class |
Snapshots.Revisions |
Modifier and Type | Field and Description |
---|---|
private java.util.Map<java.lang.String,java.util.TreeMap<java.lang.Integer,java.util.TreeSet<java.lang.String>>> |
directory |
private java.io.File |
storageLocation |
Constructor and Description |
---|
Snapshots(java.io.File location) |
Modifier and Type | Method and Description |
---|---|
java.util.Set<java.util.Date> |
announceDeletion(DigestURL url,
int depth)
Delete information about the storage of a snapshot to the Snapshot-internal index.
|
void |
announceStorage(DigestURL url,
int depth,
java.util.Date date)
Write information about the storage of a snapshot to the Snapshot-internal index.
|
java.io.File |
definePath(DigestURL url,
int depth,
java.util.Date date,
java.lang.String ext)
Compute the path of a snapshot.
|
java.util.Collection<java.io.File> |
findPaths(DigestURL url,
int depth,
java.lang.String ext)
for a given url, get all paths for storage locations.
|
java.util.Collection<java.io.File> |
findPaths(DigestURL url,
java.lang.String ext)
for a given url, get all paths for storage locations.
|
int |
getDepth(DigestURL url,
Fulltext fulltext)
get the depth to a document, helper method for definePath to determine the depth value
|
Snapshots.Revisions |
getRevisions(java.lang.String urlhash) |
java.util.Set<java.lang.String> |
listHosts()
get a list of
|
java.util.TreeMap<java.lang.Integer,java.util.Collection<Snapshots.Revisions>> |
listIDs(java.lang.String hostport,
int depth)
list the snapshots for a given host name
|
int |
listIDsSize(java.lang.String hostport,
int depth)
get the number of snapshots for the given host name
|
private static java.util.Date |
parseDate(java.lang.String d) |
private java.lang.String |
pathToDepthDir(int depth) |
private java.lang.String |
pathToHostPortDir(java.lang.String host,
int port) |
private java.io.File |
pathToShard(DigestURL url,
int depth) |
private java.lang.String |
pathToShard(java.lang.String urlhash) |
private java.io.File |
pathToShard(java.lang.String hostport,
java.lang.String urlhash,
int depth) |
java.util.LinkedHashMap<java.lang.String,Snapshots.Revisions> |
select(java.lang.String host,
java.lang.Integer depth,
Snapshots.Order order,
int maxcount)
select a set of urlhashes from the snapshot directory.
|
int |
size()
get the number of entries in the snapshot directory
|
private java.io.File storageLocation
private java.util.Map<java.lang.String,java.util.TreeMap<java.lang.Integer,java.util.TreeSet<java.lang.String>>> directory
public int size()
public java.util.Set<java.lang.String> listHosts()
public Snapshots.Revisions getRevisions(java.lang.String urlhash)
public java.util.TreeMap<java.lang.Integer,java.util.Collection<Snapshots.Revisions>> listIDs(java.lang.String hostport, int depth)
hostport
- the depth
- restrict the result to the given depth or if depth == -1 do not restrict to a depthpublic int listIDsSize(java.lang.String hostport, int depth)
hostport
- the depth
- restrict the result to the given depth or if depth == -1 do not restrict to a depthpublic java.io.File definePath(DigestURL url, int depth, java.util.Date date, java.lang.String ext)
url
- ext
- depth
- date
- public void announceStorage(DigestURL url, int depth, java.util.Date date)
url
- depth
- date
- public java.util.Set<java.util.Date> announceDeletion(DigestURL url, int depth)
url
- depth
- date
- public java.util.LinkedHashMap<java.lang.String,Snapshots.Revisions> select(java.lang.String host, java.lang.Integer depth, Snapshots.Order order, int maxcount)
host
- selected host or null for all hostsdepth
- selected depth or null for all depthsorder
- Order.ANY, Order.OLDESTFIRST or Order.LATESTFIRSTmaxcount
- the maximum number of hosthashes. If unlimited, submit Integer.MAX_VALUEprivate static java.util.Date parseDate(java.lang.String d)
public int getDepth(DigestURL url, Fulltext fulltext)
url
- fulltext
- public java.util.Collection<java.io.File> findPaths(DigestURL url, java.lang.String ext)
url
- ext
- public java.util.Collection<java.io.File> findPaths(DigestURL url, int depth, java.lang.String ext)
url
- ext
- required extension or null if the extension must not be checkeddepth
- private java.io.File pathToShard(DigestURL url, int depth)
private java.io.File pathToShard(java.lang.String hostport, java.lang.String urlhash, int depth)
private java.lang.String pathToHostPortDir(java.lang.String host, int port)
private java.lang.String pathToDepthDir(int depth)
private java.lang.String pathToShard(java.lang.String urlhash)