org.abora.gold.snarf
Class SnarfRecord

java.lang.Object
  |
  +--org.abora.gold.java.AboraHeaper
        |
        +--org.abora.gold.xpp.basic.Heaper
              |
              +--org.abora.gold.snarf.SnarfRecord

public class SnarfRecord
extends Heaper

Manage retrieval, refitting, and rewriting of existing flocks. Assign indices for new
flocks.
SnarfRecords can go away after their contents have been flushed. We might keep it around
if we expect to be assigning new flocks to the snarf again, just to keep myOccupied. The
snarfRecord will be recreated when another object is read in.


Field Summary
protected  PrimPtrTable myChangedFlocks
           
protected  int myDestroyCount
           
protected  IntegerRegion myOccupied
           
protected  SnarfPacker myPacker
           
protected  SnarfID mySnarfID
           
protected  int mySpaceLeft
           
 
Fields inherited from class org.abora.gold.xpp.basic.Heaper
AllBlasts, BecomeMap, GarbageCount, InGC, InitializedClasses, InitializingClasses, LastMemory, NextClientRequestNumber, NotOneElementSignal, PackageTable, PromiseNameTable, StringHashSBoxes
 
Fields inherited from class org.abora.gold.java.AboraHeaper
ActiveClubs, CurrentAuthor, CurrentBertCanopyCache, CurrentBertCrum, CurrentChunk, CurrentGrandMap, CurrentKeyMaster, CurrentPacker, CurrentSensorCanopyCache, CurrentServer, CurrentSession, CurrentSessions, CurrentTrace, InitialEditClub, InitialOwner, InitialReadClub, InitialSponsor, InsideTransactionFlag
 
Constructor Summary
SnarfRecord(SnarfID snarfID, SnarfPacker packer, int spaceLeft)
           
 
Method Summary
 int actualHashForEqual()
           
 int allocate(int size, Abraham shep)
          Shep is being newly added to this snarf.
 IntegerVar allocateIndex()
          Return the first unoccupied index in the snarf.
 void changedFlock(int index, Abraham shep)
          Remember that the flock at index must be written to the snarf on the next update.
 void destruct()
          Destroy all objects imaged from this snarf.
 void dismantleFlock(FlockInfo info)
          Remove the flock from the disk.
 FlockLocation fetchForward(int index)
          If the location specified by info has been forwarded, return a flockInfo
describing its new location.
 void flushChanges()
          Rewrite all flocks that have changed in this snarf.
 MuSet forgottenFlocks()
          Return the set of indices to locations that are forgotten.
 SnarfHandler getWriteHandler()
          Get the handler for my snarf so that I can send or receive data from it.
 boolean isEqual(java.lang.Object other)
           
 boolean isForgotten(int index)
          Return true if the flock at that location is forgotten.
 boolean isPurgeable()
          Return true if everything in this snarfRecord is purged.
If so, then this snarfRecord can be thrown away.
static Heaper make(SnarfID snarfID, SnarfPacker packer, int spaceLeft)
           
 void makeReal(int index, Abraham stub)
          We know that the object wasn't imaged.
 Abraham originateFlock(IntegerVar index)
          This will get a flock that we know the location of
without a stub.
 void printOn(java.io.PrintWriter oo)
           
 void readOccupied()
          Create an array with the sizes of every flock in the snarf.
 void refitFlocks()
          Recompute size information for all changed shepherds and see if they still fit.
Any that don't get handed to the SnarfPacker to treat as new flocks.
 void setSpaceLeft(int spaceLeft)
           
 int spaceLeft()
          Return the amount of space currently left in the snarf.
 IntegerVar wipeBelowHighest(int highest, SnarfHandler handler)
           
 
Methods inherited from class org.abora.gold.xpp.basic.Heaper
abstractDeclarationFor, abstractTypeFor, addMethodAttributeToInOf, addPackage, addPackageCategory, allClientProtocolOn, argumentTypesFor, arrow, blast, blast, BLAST, cachePromiseNameTable, cachePromiseNameTableIn, canYouBecome, cast, cleanPromiseClasses, cleanupGarbage, clientClassesDo, clientFunctionsOn, clientMethodsOn, clientProtocol, clientProtocolDo, clientProtocolOn, clientProtocolOn, collectibleClasses, compare, compileClientSubclasses, compileConstantPromiseMethods, compileCreateFromRcvr, compileEQ, compileGeneratedClassMethod, compileGeneratedMethod, compileHook, compilePromise, compilePromiseDefaultMethods, compilePromiseFluidDeclarations, compilePromiseHandlers, compilePromiseMethods, compileRequestCreateMsgInArguments, compileRequestEvaluateMsgInReturningArguments, compileRPCSpecialistEvaluateMsgForReturningArguments, compileSendSelfTo, compileSendSelfToSendHook, compileStubbleMethods, compileSubclassStubbleMethods, computeMangle, computePreorder, constantTypeValue, convert, convertCopyDeclarations, convertDeferredDeclarations, convertProxyDeclarations, convertSubclassCopyDeclarations, convertSubclassDeferredDeclarations, convertSubclassProxyDeclarations, copyReferencesToType, create, create, create, create, create, create, create, create, create, create, createRequestClassArguments, definesProxyMethods, delete, deref, destroy, destructor, enum, enumFlags, equals, exportName, fetchAttribute, fetchPackage, fetchSuperCategory, fileOutClientProtocol, findCategory, findSenderAndReceiverMethods, findTailInto, flushPromiseNameTable, foo, freezeClientClasses, freezeClientProtocol, freezeStProtocol, frozenClasses, garbageCollect, garbageCollectFrom, gcOpportunity, gcOpportunity, generatedCategory, generatePromiseNames, getCategory, getOrMakePackage, getSuperCategory, handlerSignaturesFrom, hash, hashForEqual, hasProxyMethods, info_clientClasses, info_clientSideClasses, info_promiseClasses, info_stProtocol, inGC, initializedClasses, initializingClasses, initPackages, initStringHashSBoxes, inspectPieces, instanceSize, IntegerVar, isByProxy, isConstructed, isDestructed, isEqual, isEqualOrSubclassOf, isGenerated, isIntType, isKindOf, isRawType, isUnlocked, linkTimeNonInherited, make, makeClassTable, makeFillTable, makeRequestTable, mangle, markChildren, markCount, markInstances, mayBecome, mayBecomeAnySubclassOf, new1, newX, nonCopyVariables, notWorking, pack, packageClasses, packagingCategory, parseExportName, passe, pointerToStaticMember, pointerToStaticMember, pointerToVirtualMember, preorderMax, preorderNumber, PROBLEM, problems, promiseClass, promiseDefaultValue, promiseName, promiseNameTable, promiseToAbstract, registerPackageCategory, removeGeneratedCode, removeStubbleMethods, removeSubclassGeneratedCode, removeSubclassStubbleMethods, requestProcedure, requestProceduresFrom, returnTypeFor, rootName, scheduleTermination, sendProxyTo, sendSelfTo, serverNameFor, setGC, signal, signals, smalltalkSelector, stClientProtocol, stubbleSelectorTokenReturnsArguments, subclassNonCopyVariables, takeOop, togglePromiseName, togglePromiseOfParse, unimplemented, unmangle, verifyFreeze, wipeStubble
 
Methods inherited from class org.abora.gold.java.AboraHeaper
asOop, basicInspect, displayString, error, hack, halt, inspect, knownBug, mightNotImplement, REQUIRES, shouldImplement, shouldNotImplement, stubbleForSubclassResponsibility, thingToDo, willNotImplement
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mySnarfID

protected SnarfID mySnarfID

myPacker

protected SnarfPacker myPacker

mySpaceLeft

protected int mySpaceLeft

myOccupied

protected IntegerRegion myOccupied

myChangedFlocks

protected PrimPtrTable myChangedFlocks

myDestroyCount

protected int myDestroyCount
Constructor Detail

SnarfRecord

public SnarfRecord(SnarfID snarfID,
                   SnarfPacker packer,
                   int spaceLeft)
Method Detail

allocate

public int allocate(int size,
                    Abraham shep)
Shep is being newly added to this snarf. Allocate enough space for it and return the
newly assigned index for it.


changedFlock

public void changedFlock(int index,
                         Abraham shep)
Remember that the flock at index must be written to the snarf on the next update.


dismantleFlock

public void dismantleFlock(FlockInfo info)
Remove the flock from the disk. Replace it with a Pumpkin so that the
routine that flushes to disk knows to remove whatever's there already.


flushChanges

public void flushChanges()
Rewrite all flocks that have changed in this snarf.


refitFlocks

public void refitFlocks()
Recompute size information for all changed shepherds and see if they still fit.
Any that don't get handed to the SnarfPacker to treat as new flocks. The
old space changed and dismantled flocks has been returned to the pool.
Reallocate space for the changed flocks out of the pool. Any that don't fit
are handed back to myPacker to go in other snarfs.


spaceLeft

public int spaceLeft()
Return the amount of space currently left in the snarf.


destruct

public void destruct()
Destroy all objects imaged from this snarf.

Overrides:
destruct in class Heaper

allocateIndex

public IntegerVar allocateIndex()
Return the first unoccupied index in the snarf. Compute the lowest
element >= 0 that is not already in the occupied region by subtracting
the occupied region from the region >= 0.


getWriteHandler

public SnarfHandler getWriteHandler()
Get the handler for my snarf so that I can send or receive data from it.


readOccupied

public void readOccupied()
Create an array with the sizes of every flock in the snarf.


setSpaceLeft

public void setSpaceLeft(int spaceLeft)

wipeBelowHighest

public IntegerVar wipeBelowHighest(int highest,
                                   SnarfHandler handler)

printOn

public void printOn(java.io.PrintWriter oo)
Overrides:
printOn in class Heaper

fetchForward

public FlockLocation fetchForward(int index)
If the location specified by info has been forwarded, return a flockInfo
describing its new location.


forgottenFlocks

public MuSet forgottenFlocks()
Return the set of indices to locations that are forgotten.


isForgotten

public boolean isForgotten(int index)
Return true if the flock at that location is forgotten. Higher level routines
should make sure this doesn't get done very often because it requires bringing
in the snarf if it's not already there.


isPurgeable

public boolean isPurgeable()
Return true if everything in this snarfRecord is purged.
If so, then this snarfRecord can be thrown away.


makeReal

public void makeReal(int index,
                     Abraham stub)
We know that the object wasn't imaged. Read the real shepherd into
the memory occupied by stub. If the location is a forwarder, then
register a new flockInfo with the stub and just return.


originateFlock

public Abraham originateFlock(IntegerVar index)
This will get a flock that we know the location of
without a stub. The flock must not already be imaged,
and it must not be forwarded.


actualHashForEqual

public int actualHashForEqual()
Overrides:
actualHashForEqual in class Heaper

isEqual

public boolean isEqual(java.lang.Object other)

make

public static Heaper make(SnarfID snarfID,
                          SnarfPacker packer,
                          int spaceLeft)


Translation - Copyright © 2003 David G Jones. All Rights Reserved.
Original Udanax-Gold - Copyright © 1979-1999 Udanax.com. All rights reserved.