public class Transactions
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Transactions.State |
Modifier and Type | Field and Description |
---|---|
private static Snapshots |
archive |
private static java.io.File |
archiveDir |
private static java.util.concurrent.ExecutorService |
executor |
private static java.util.concurrent.atomic.AtomicInteger |
executorRunning |
private static Snapshots |
inventory |
private static java.io.File |
inventoryDir |
private static java.io.File |
transactionDir |
private static char[] |
WHITESPACE |
private static java.lang.String |
XML_PREFIX |
Constructor and Description |
---|
Transactions() |
Modifier and Type | Method and Description |
---|---|
static void |
announceDeletion(DigestURL url,
int depth,
Transactions.State state)
Delete information about the storage of a snapshot to the Snapshot-internal index.
|
static void |
announceStorage(DigestURL url,
int depth,
java.util.Date date,
Transactions.State state)
Write information about the storage of a snapshot to the Snapshot-internal index.
|
static Snapshots.Revisions |
commit(java.lang.String urlhash)
Announce the commit of a snapshot: this will move all data for the given urlhash from the inventory to the archive
The index within the snapshot management will update also.
|
static java.io.File |
definePath(DigestURL url,
int depth,
java.util.Date date,
java.lang.String ext,
Transactions.State state)
Compute the path of a snapshot.
|
static java.util.Collection<java.io.File> |
findPaths(DigestURL url,
int depth,
java.lang.String ext,
Transactions.State state)
for a given url, get all paths for storage locations.
|
static java.util.Collection<java.io.File> |
findPaths(DigestURL url,
java.lang.String ext,
Transactions.State state)
for a given url, get all paths for storage locations.
|
static Snapshots.Revisions |
getRevisions(Transactions.State state,
java.lang.String urlhash) |
static void |
init(java.io.File dir) |
static java.util.Set<java.lang.String> |
listHosts(Transactions.State state)
get a list of
|
static java.util.TreeMap<java.lang.Integer,java.util.Collection<Snapshots.Revisions>> |
listIDs(java.lang.String hostport,
int depth,
Transactions.State state)
list the snapshots for a given host name
|
static int |
listIDsSize(java.lang.String hostport,
int depth,
Transactions.State state)
get the number of snapshots for the given host name
|
static Snapshots.Revisions |
rollback(java.lang.String urlhash)
Announce the rollback of a snapshot: this will move all data for the given urlhash from the archive to the inventory
The index within the snapshot management will update also.
|
static java.util.LinkedHashMap<java.lang.String,Snapshots.Revisions> |
select(java.lang.String host,
java.lang.Integer depth,
Snapshots.Order order,
int maxcount,
Transactions.State state)
select a set of urlhashes from the snapshot directory.
|
static java.util.Map<java.lang.String,java.lang.Integer> |
sizes()
get the number of entries for each of the transaction states
|
static boolean |
store(DigestURL url,
java.util.Date date,
int depth,
boolean concurrency,
boolean replaceOld,
java.lang.String proxy,
java.lang.String acceptLanguage) |
static boolean |
store(SolrInputDocument doc,
boolean concurrency,
boolean loadImage,
boolean replaceOld,
java.lang.String proxy,
java.lang.String acceptLanguage) |
private static Snapshots.Revisions |
transact(java.lang.String urlhash,
Transactions.State from,
Transactions.State to) |
private static final java.lang.String XML_PREFIX
private static final char[] WHITESPACE
private static java.io.File transactionDir
private static java.io.File inventoryDir
private static java.io.File archiveDir
private static Snapshots inventory
private static Snapshots archive
private static java.util.concurrent.ExecutorService executor
private static java.util.concurrent.atomic.AtomicInteger executorRunning
public static void init(java.io.File dir)
public static java.util.Map<java.lang.String,java.lang.Integer> sizes()
public static Snapshots.Revisions getRevisions(Transactions.State state, java.lang.String urlhash)
public static java.util.Set<java.lang.String> listHosts(Transactions.State state)
public static java.util.TreeMap<java.lang.Integer,java.util.Collection<Snapshots.Revisions>> listIDs(java.lang.String hostport, int depth, Transactions.State state)
hostport
- the depth
- restrict the result to the given depth or if depth == -1 do not restrict to a depthstate
- the wanted transaction state, State.INVENTORY, State.ARCHIVE or State.ANYpublic static int listIDsSize(java.lang.String hostport, int depth, Transactions.State state)
hostport
- the depth
- restrict the result to the given depth or if depth == -1 do not restrict to a depthstate
- the wanted transaction state, State.INVENTORY, State.ARCHIVE or State.ANYpublic static boolean store(SolrInputDocument doc, boolean concurrency, boolean loadImage, boolean replaceOld, java.lang.String proxy, java.lang.String acceptLanguage)
public static boolean store(DigestURL url, java.util.Date date, int depth, boolean concurrency, boolean replaceOld, java.lang.String proxy, java.lang.String acceptLanguage)
public static Snapshots.Revisions commit(java.lang.String urlhash)
urlhash
- public static Snapshots.Revisions rollback(java.lang.String urlhash)
urlhash
- private static Snapshots.Revisions transact(java.lang.String urlhash, Transactions.State from, Transactions.State to)
public static java.util.LinkedHashMap<java.lang.String,Snapshots.Revisions> select(java.lang.String host, java.lang.Integer depth, Snapshots.Order order, int maxcount, Transactions.State state)
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_VALUEstate
- the wanted transaction state, State.INVENTORY, State.ARCHIVE or State.ANYpublic static java.io.File definePath(DigestURL url, int depth, java.util.Date date, java.lang.String ext, Transactions.State state)
url
- depth
- date
- ext
- state
- the wanted transaction state, State.INVENTORY, State.ARCHIVE or State.ANYpublic static void announceStorage(DigestURL url, int depth, java.util.Date date, Transactions.State state)
state
- the wanted transaction state, State.INVENTORY, State.ARCHIVE or State.ANYurl
- depth
- date
- public static void announceDeletion(DigestURL url, int depth, Transactions.State state)
state
- the wanted transaction state, State.INVENTORY, State.ARCHIVE or State.ANYurl
- depth
- date
- public static java.util.Collection<java.io.File> findPaths(DigestURL url, java.lang.String ext, Transactions.State state)
url
- ext
- required extension or null if the extension must not be checkedstate
- the wanted transaction state, State.INVENTORY, State.ARCHIVE or State.ANYpublic static java.util.Collection<java.io.File> findPaths(DigestURL url, int depth, java.lang.String ext, Transactions.State state)
url
- ext
- required extension or null if the extension must not be checkeddepth
- state
- the wanted transaction state, State.INVENTORY, State.ARCHIVE or State.ANY