|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.faunos.skwish.sys.filters.DeleteSet com.faunos.skwish.sys.mgr.FileBackedDeleteSet
public class FileBackedDeleteSet
A DeleteSet
that is backed by a file. The file format
used is super brittle.
DELETED_ID_LIST := MIN_ID, MAX_ID, <DELETED_ID> n = 0, 1, 2, ..
MIN_ID := LONG
MAX_ID := LONG
DELETED_ID := LONG
LONG := <BYTE>8
loadInstance(FileChannel)
to fail.) However, the implementation never
produces duplicates, either.
The implementation is not safe for concurrent access. In particular, the
backing FileChannel
's position is assumed to be owned
by the instance.
Field Summary | |
---|---|
protected static ChannelUtil<DeleteSetException> |
helper
|
Fields inherited from class com.faunos.skwish.sys.filters.DeleteSet |
---|
deletedIds, validator |
Constructor Summary | |
---|---|
protected |
FileBackedDeleteSet(FileChannel deletedIdsFile,
long minId,
long maxId)
Used internally and by subclasses. |
Method Summary | |
---|---|
void |
close()
|
boolean |
delete(long id)
Adds the given id to the delete-set. |
void |
flush()
|
Set<Long> |
getRawDeletedIds()
|
boolean |
include(DeleteSet other)
Operation not supported. |
boolean |
isIncludeSupported()
Determines whether the instance supports the include method. |
static FileBackedDeleteSet |
loadInstance(FileChannel deletedIdsFile)
Loads and returns an already existing instance from the given backing file. |
static FileBackedDeleteSet |
writeNewInstance(FileChannel deletedIdsFile,
long minId,
long maxId)
Writes a new, empty deleted ID list to the given backing file and returns a new instance of this class. |
Methods inherited from class com.faunos.skwish.sys.filters.DeleteSet |
---|
combine, getCount, getDeletedIds, getMaxId, getMinId, initSet, inRange, isDeleted, toString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected static final ChannelUtil<DeleteSetException> helper
Constructor Detail |
---|
protected FileBackedDeleteSet(FileChannel deletedIdsFile, long minId, long maxId)
loadInstance(FileChannel)
,
writeNewInstance(FileChannel, long, long)
Method Detail |
---|
public static FileBackedDeleteSet loadInstance(FileChannel deletedIdsFile) throws IOException
IOException
public static FileBackedDeleteSet writeNewInstance(FileChannel deletedIdsFile, long minId, long maxId) throws IOException
IOException
public boolean delete(long id) throws IOException
DeleteSet
id
to the delete-set.
delete
in class DeleteSet
id
- the ID to be deleted, which lie in this delete-set's range
true
, if the specified id
wasn't already deleted; false
, o.w.
IOException
public boolean include(DeleteSet other) throws IOException, UnsupportedOperationException
include
in class DeleteSet
UnsupportedOperationException
IOException
public boolean isIncludeSupported()
DeleteSet
include
method.
isIncludeSupported
in class DeleteSet
false
public void close() throws IOException
close
in interface Closeable
IOException
public void flush() throws IOException
IOException
public Set<Long> getRawDeletedIds()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |