com.faunos.skwish.sys.filters
Class DeleteSetFilterSegment
java.lang.Object
com.faunos.skwish.Segment
com.faunos.skwish.sys.filters.FilterSegment
com.faunos.skwish.sys.filters.AppendProtectedFilterSegment
com.faunos.skwish.sys.filters.DeleteSetFilterSegment
- All Implemented Interfaces:
- Range
public class DeleteSetFilterSegment
- extends AppendProtectedFilterSegment
A FilerSegment
employing a DeleteSet
.
Invariants
Let deletedIds
be the underlying DeleteSet
.
Let inner
be the underlying Segment
. Then
inner.getBaseId()
≥ deletedIds.getMinId()
- Author:
- Babak Farhang
Method Summary |
void |
delete(long startId,
int count,
boolean purge)
Deletes count entries starting at the entry with the
specified id. |
void |
getEntry(long id,
ByteBuffer out,
ByteBuffer workBuffer)
Returns the contents of the entry with the specified id. |
long |
getEntrySize(long id,
ByteBuffer workBuffer)
Returns the size of the entry with the specified id. |
boolean |
isReadOnly()
Determines whether this instance is read-only (unmodifiable). |
Methods inherited from class com.faunos.skwish.Segment |
contains, delete, delete, getEntry, getEntrySize, getEntryStream, hi, isDeleted, isDeleted, killNext, lo, toString |
DeleteSetFilterSegment
public DeleteSetFilterSegment(Segment inner,
DeleteSet deletedIds)
- Creates a new instance using the given
inner
instance,
and deletedIds
.
delete
public void delete(long startId,
int count,
boolean purge)
throws IOException
- Description copied from class:
Segment
- Deletes count entries starting at the entry with the
specified id. The contents of the deleted entries may optionally be
requested to be purged (overwritten) immediately; o.w. the deleted contents will
be purged whenever the segment is compacted or merged with another segment.
Note that purging is not part of any transaction semantic; whether
or not a purge immediately takes place on its being signaled is
implementation-dependent.
- Overrides:
delete
in class FilterSegment
- Parameters:
startId
- the ID of the first entry to be deleted. Must be
a valid ID in this segment [baseId, baseId + entryCount)count
- the number of entries to be deleted. Specifies a
range of IDs to be deleted: [id, id + count). The range
of IDs must be valid entries within this segment; o.w.
an exception is raised.purge
- if true
, the contents of the deleted entries
are signaled to be purged (overwritten) immediately;
o.w. the contents will be deleted on the next time the segment is
compacted.
- Throws:
IOException
getEntry
public void getEntry(long id,
ByteBuffer out,
ByteBuffer workBuffer)
throws IOException
- Description copied from class:
Segment
- Returns the contents of the entry with the specified id. If the entry
is deleted, the method returns without modifying the
out
buffer.
- Overrides:
getEntry
in class FilterSegment
out
- the buffer into which the contents are written. Its
remaining bytes must be large enough; o.w., an exception is raised.workBuffer
- a work buffer used internally to read offsets. The minimum
capacity of this work buffer must be 16
- Throws:
IOException
getEntrySize
public long getEntrySize(long id,
ByteBuffer workBuffer)
throws IOException
- Description copied from class:
Segment
- Returns the size of the entry with the specified id. A work buffer
with a minimum size of 16 must be passed in.
- Overrides:
getEntrySize
in class FilterSegment
- Returns:
- the size of the entry if present; -1, if deleted.
- Throws:
IOException
isReadOnly
public boolean isReadOnly()
- Description copied from class:
Segment
- Determines whether this instance is read-only (unmodifiable).
- Overrides:
isReadOnly
in class FilterSegment
- See Also:
- Write operations