Index - All Packages - All Categories - All Classes

Class SnarfPacker

Should myFlocks contain full flockInfos for forwarded flocks? Both the flags and the size mean nothing.

A SnarfPacker maintains the relationship between Shepherds and the set of snarfs representing the disk. A SnarfPacker assigns flocks to snarfs based loosely on the flocks's Shepherd's preferences. When a flock changes, it informs the SnarfPacker. When the SnarfPacker decides to write to the disk, it ensures that the changed objects still fit in their snarf (migrating them if necessary), writes them to the snarf, then writes out the snarf.

mySnarfInfo
- How much space remains in each snarf.
mySnarfMap
- Map from snarfIDs to a SnarfRecord that handles that snarf.
myChangedSnarfs
- The IDs for all snarfs in which an imaged flock has changed.
myFlocks
- Indexed by Abraham hash, contains all FlockInfos that refer to flocks in memory.
Multiple infos may refer to the same flock if it is referenced through forwarding.
The only info considered to have the correct state wrt its flocks suitability for
purging is the info pointed to by its Abraham.
myInsideCommit
- True while writing new and changed flocks to disk to prevent purging,
and during purgeClean to prevent recursive call through Purgeror recycling.

Package: Udanax-Gold
All Superclasses: Object Heaper DiskManager
Protocols: Object
Categories: Xanadu-Snarf

Class Methods

bombResetCommit: CHARGE


initializeUrdiOnDisk: fname


linkTimeNonInherited



Overrides: DiskManager class

make: fname



Overrides: DiskManager class

Instance Methods

addInfo: info with: shep

Add another flockInfo object to myFlocks with info about another location for shep.

assignSnarf: shep

Find a snarf in which to fit shep. Then assign it to
that location, and mark that snarf as changed.

beginConsistent: dirtyFlocks



Overrides: DiskManager

checkInfos

Perform the sanity check of the moment. Beware the compile cost of changing this comment.

commitState: flag

Used by ResetCommit bomb

commitView

Commit by destroying the current view and creating a new one.

computeSize: flock

Send the snarf over a transmitter into a stream that just counts the bytes put
into it.

consistent: dirty with: aBlock



Overrides: DiskManager

consistentCount


create: urdi


currentView

Return the current urdiView.

destroyAbandoned

Destroy all forgotten flocks that are no longer in memory.

destroyFlock: info

Queue destroy of the given flock. The destroy will happen later.

Overrides: DiskManager

destruct

Destroy all objects imaged from this snarf.

Overrides: DiskManager

diskUpdate: info



Overrides: DiskManager

dismantleFlock: info

Turn the flock designated by info into a Pumpkin. It should have completed all dismantle actions.

Overrides: DiskManager

dropFlock: token

The flock is being removed from memory. For now, this is an error
if the flock has been updated. If the flock has been forgotten,
then it will be dismantled when next it comes in from disk.
Because of forwarding, there may be many FlockInfos refering
to the flock if it is not new.

Overrides: DiskManager

endConsistent: dirty



Overrides: DiskManager

fetchCanonical: hash with: snarfID with: index

If something is already imaged at that location, then return it. If there is already
an existing stub with the same hash at a different location, follow them till we
know that they are actually different objects.

Overrides: DiskManager

fetchInMemory: snarfID with: index

Return true if the object is on disk but not in memory.

flushFlocks

Actually write all the changed and newly assigned flocks to the disk.

forgetFlock: info

Remember that there are no more persistent pointers to the shepherd
represented by info. If it gets manually deleted, dismantle it immediately.
If it gets garbage collected, remember to dismantle it when it comes back
in from the disk.

Overrides: DiskManager

forgottenFlocks: snarfID

Return the set of indices to flocks in snarf snarfID that are forgotten.

forwardFlock: shep

Shep has grown too large for its current place. Treat it as just a new flock and give it another place.

getFlock: snarfID with: index

Return a flock at a particular location. This needs to register
the flock if it doesn't exist already.

getInitialFlock

Return the starting object for the entire backend. This will be the 0th
flock in the first snarf following the snarfInfo tables.

Overrides: DiskManager

getReadHandler: snarfID

Get the read handler on the snarf.

getSnarfRecord: snarfID

Return the snarfRecord for snarfID. The SnarfRecord must exist if there are
changed flocks imaged out of that snarf, but might not otherwise. Create it if necessary.

insideCommit



Overrides: DiskManager

isFake



Overrides: DiskManager

makePersistent

The virtual image in memory is now in a consistent state. Write the image of
all changed or new Shepherds out to the disk in a single atomic action. The
atomicity only happens on top of a real Urdi, however.

makeRcvr: readStream


makeReal: info

Retrieve from the disk the flock at index within the specified snarf. Since
stubs are canonical, and this only gets called by stubs, the existing stub will
*become* the shepherd for the flock.

Overrides: DiskManager

makeXmtr: writeStream


nextHashForEqual

Shepherds use a sequence number for their hash. Return the next one
and increment. This should actually spread the hashes.

Overrides: DiskManager

purge

Flush everything out to disk and remove all purgeable imaged
objects from memory.

Overrides: DiskManager

purgeClean


purgeClean: noneLocked

purge all shepherds that are currently clean, not locked, not dirty,
and purgeable. Purging just turns them into stubs, freeing all their
flocks. Garbage collection can clean up the flocks and any stubs no
longer pointed to by something in memory. Because infos for new
flocks don't appear in myFlocks, this will not throw out any newFlocks
(which will be marked dirty anyway). For each FlockInfo, we check
that its flock refers to that exact instance to get correct information
about its dirty state.

Overrides: DiskManager

recordUpdate: info

The flock represented by info has changed. Record it in the
bookkeeping data-structures. This must be called by all things
that affect whether the flock gets rewritten to disk.

refitFlocks

Make sure all flocks that have changed still fit in their snarfs.
Add any that don't to myNewFlocks and return the table
from their current locations to the newShepherds.

registerStub: shep with: snarfID with: index



Overrides: DiskManager

releaseReadHandler: handler

Release the supplied snarfHandler and destroy it.

rememberFlock: info

There are now persistent pointers to the shepherd help by info.

Overrides: DiskManager

resolveLocation: info

Make sure that the shepherd or stub at that location actually points
at the real location for a shepherd. This will resolve forwarding pointers,
but not instantiate any flocks.

setHashCounter: aCounter



Overrides: DiskManager

storeAlmostNewShepherd: shep

Do nothing

Overrides: DiskManager

storeInitialFlock: turtle with: protocol with: cookbook

A turtle just got created! Write out a pseudo-forwarder that has all the protocol information encoded in the snarfID and index.

Overrides: DiskManager

storeNewFlock: shep

Shep just got created! On some later commit, assign it to a snarf
and write it to the disk.

Overrides: DiskManager

testNewFlocks




Index - All Packages - All Categories - All Classes