Data

Undocumented in source.
version(unittest)
@safe static
@recordType("D")
struct Data {}

Members

Mixins

__anonymous
mixin HiBONRecord!(q{ this(string text) { this.text = text; } })
Undocumented in source.

Variables

text
string text;
Undocumented in source.

Mixed In Members

From mixin HiBONRecord!(q{ this(string text) { this.text = text; } })

check
alias check = Check!(HiBONRecordException)
Undocumented in source.
__anonymous
mixin JSONString
Undocumented in source.
__anonymous
mixin HiBONRecordType
Undocumented in source.
isRecord
alias isRecord = HiBONRecord.isRecord!ThisType
Undocumented in source.
HAS_TYPE
enum HAS_TYPE;
Undocumented in source.
less_than
bool less_than(Key a, Key b)
Undocumented in source. Be warned that the author may not have intended to support it.
toHiBON
inout(HiBON) toHiBON()
Undocumented in source. Be warned that the author may not have intended to support it.
NO_DEFAULT_CTOR
enum NO_DEFAULT_CTOR;
Undocumented in source.
GetKeyName
template GetKeyName(uint i)
Undocumented in source.
_keys
string[] _keys()
keys
enum keys;
Undocumented in source.
this
this(HiBON hibon)
Undocumented in source.
this
this(Document doc)
Undocumented in source.
serialize
immutable(ubyte[]) serialize()
Undocumented in source. Be warned that the author may not have intended to support it.
toDoc
const(Document) toDoc()
Undocumented in source. Be warned that the author may not have intended to support it.

Examples

No elements should have been added to the recycler.

immutable filename = fileId("recycle").fullpath;
filename.forceRemove;

BlockFile.create(filename, "recycle.unittest", SMALL_BLOCK_SIZE);
auto blockfile = BlockFile(filename);
scope (exit) {
    blockfile.close;
}
auto recycler = Recycler(blockfile);

RecycleSegment*[] dispose_segments = [
    new RecycleSegment(Index(1UL), 5),
    new RecycleSegment(Index(10UL), 5),
    new RecycleSegment(Index(17UL), 5),
    new RecycleSegment(Index(25UL), 5),
];

recycler.insert(dispose_segments[]);
assert(recycler.indices.length == 4);
assert(recycler.segments.length == 4);

auto remove_segment = new RecycleSegment(Index(17UL), 5);

recycler.remove(remove_segment);

assert(recycler.indices.length == 3);
assert(recycler.segments.length == 3);

RecycleSegment*[] segs = [
    new RecycleSegment(Index(1UL), 5),
    new RecycleSegment(Index(10UL), 5),
    // new RecycleSegment(Index(17UL), 5, Type.NONE), // This is the one that should be removed
    new RecycleSegment(Index(25UL), 5),
];

// recycler.indices[].array
//     .sort!((a, b) => a < b)
//     .each!writeln;

// recycler.segments[].array
//     .sort!((a, b) => a < b)
//     .each!writeln;

assert(equal(recycler.indices[].array.sort!((a, b) => a < b), recycler.segments[].array.sort!((a, b) => a < b)));

Meta