org.abora.gold.snarf
Class DiskManager

java.lang.Object
  |
  +--org.abora.gold.java.AboraHeaper
        |
        +--org.abora.gold.xpp.basic.Heaper
              |
              +--org.abora.gold.snarf.DiskManager
Direct Known Subclasses:
CBlockTrackingPacker, FakePacker, SnarfPacker, TestPacker

public class DiskManager
extends Heaper

This is the public interface for managing objects that should go to disk.
This is also the anchor for the so-called Backend emulsion, but I''ll call it
the DiskManager emulsion for simplicity.


Field Summary
protected  PrimPtrTable myFlockInfoTable
           
protected  WeakPtrArray myFlockTable
           
protected  char myFluidSpace
           
protected static Emulsion SecretEmulsion
           
 
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
DiskManager()
           
 
Method Summary
 int actualHashForEqual()
           
 void beginConsistent(IntegerVar dirty)
          This is called before entering consistent block.
static void bomb(IntegerVar CHARGE)
           
static void cleanupGarbage()
          Heaper cleanupGarbage
static void consistent(BlockClosure aBlock)
          Execute the block inside a pseudo-transaction.
static void consistent(IntegerVar dirty, BlockClosure aBlock)
          Execute the block inside a pseudo-transaction.
static void consistent(IntegerVar dirty, BlockClosure aBlock, Context context)
           
 void consistentBlockAt(java.lang.String fileName, int lineNo)
          This is called after beginConsistent, but before entering a consistent block, for
debugging purposes.
 void destroyFlock(FlockInfo info)
          Queue destroy of the given flock.
 void destruct()
          Classes should implement this message rather than a destructor.
 void diskUpdate(FlockInfo info)
          The flock described by info is Dirty!! On the next commit, rewrite it to the disk.
 void dismantleFlock(FlockInfo info)
          The flock designated by info has completed all dismantling actions; throw it off the disk.
 void dropFlock(int token)
          The flock identified by token is being removed from memory.
static Emulsion emulsion()
           
 void endConsistent(IntegerVar dirty)
          This is called after exiting a consistent block.
static void exitTimeNonInherited()
           
 Abraham fetchCanonical(int hash, SnarfID snarfID, int index)
          If something is already imaged at that location, then return it.
 PrimPtrTable flockInfoTable()
           
 void flockInfoTable(PrimPtrTable table)
           
 WeakPtrArray flockTable()
           
 void flockTable(WeakPtrArray table)
           
 java.lang.String fluidSpace()
           
 java.lang.String fluidSpace(java.lang.String aFluidSpace)
           
 void forgetFlock(FlockInfo info)
          Remember that there are no more persistent pointers to the shepherd
described by info.
 Turtle getInitialFlock()
          Return the starting object for the entire backend.
static DiskManager initializeDisk(java.lang.String fname)
          This builds the disk managing structure.
 boolean insideCommit()
           
static void insistent(BlockClosure aBlock)
          Execute the block inside a pseudo-transaction.
static void insistent(IntegerVar dirty, BlockClosure aBlock)
          Execute the block inside a pseudo-transaction.
static void insistent(IntegerVar dirty, BlockClosure aBlock, Context context)
           
 boolean isFake()
           
static void linkTimeNonInherited()
           
static Heaper make(java.lang.String fname)
           
 void makeConsistent()
          The virtual image in memory is now in a consistent state.
 void makeConsistentBegin(IntegerVar dirty)
          The virtual image in memory is now in a consistent state.
 void makeConsistentEnd()
          This is called after exiting a top level consistent block.
 void makeReal(FlockInfo info)
          Retrieve from the disk the flock at index within the specified snarf.
 int nextHashForEqual()
          Shepherds use a sequence number for their hash.
 void purge()
          Flush everything out to disk and remove all purgeable imaged objects from memory.
 void purgeClean(boolean noneLocked)
          purge all shepherds that are currently clean, not locked, not dirty, and
purgeable.
 void registerStub(Abraham shep, SnarfID snarfID, int index)
          Called to register a newly created stub (by the diskSpecialist) in the internal
tables.
 void rememberFlock(FlockInfo info)
          There are now persistent pointers to the shepherd described by info.
 void setHashCounter(Counter aCounter)
           
static void staticTimeNonInherited()
           
 void storeAlmostNewShepherd(Abraham shep)
          Shep has been created, but is not consistent yet.
 void storeInitialFlock(Abraham turtle, XcvrMaker protocol, Cookbook cookbook)
          A turtle just got created!! Remember it as the initial flock.
 void storeNewFlock(Abraham shep)
          Shep just got created!! On some later commit, assign it to a snarf
and write it to the disk.
 
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, 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, make, makeClassTable, makeFillTable, makeRequestTable, mangle, markChildren, markCount, markInstances, mayBecome, mayBecomeAnySubclassOf, new1, newX, nonCopyVariables, notWorking, pack, packageClasses, packagingCategory, parseExportName, passe, pointerToStaticMember, pointerToStaticMember, pointerToVirtualMember, preorderMax, preorderNumber, printOn, 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

myFluidSpace

protected char myFluidSpace

myFlockInfoTable

protected PrimPtrTable myFlockInfoTable

myFlockTable

protected WeakPtrArray myFlockTable

SecretEmulsion

protected static Emulsion SecretEmulsion
Constructor Detail

DiskManager

public DiskManager()
Method Detail

destroyFlock

public void destroyFlock(FlockInfo info)
Queue destroy of the given flock. The destroy will probably happen later.


diskUpdate

public void diskUpdate(FlockInfo info)
The flock described by info is Dirty!! On the next commit, rewrite it to the disk.


dismantleFlock

public void dismantleFlock(FlockInfo info)
The flock designated by info has completed all dismantling actions; throw it off the disk.


dropFlock

public void dropFlock(int token)
The flock identified by token 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.


forgetFlock

public void forgetFlock(FlockInfo info)
Remember that there are no more persistent pointers to the shepherd
described by info. If it gets garbage collected, remember to dismantle it
when it comes back in from the disk.


getInitialFlock

public Turtle getInitialFlock()
Return the starting object for the entire backend. This will be the 0th
flock in the first snarf following the snarfInfo tables. This will eventually
always be a shepherd that describes the protocol of the rest of the disk.


nextHashForEqual

public int nextHashForEqual()
Shepherds use a sequence number for their hash. The most trivial (reasonable)
implementation just uses a BatchCounter. This will not be persistent till we get
Turtles.


rememberFlock

public void rememberFlock(FlockInfo info)
There are now persistent pointers to the shepherd described by info. See forgetFlock.


setHashCounter

public void setHashCounter(Counter aCounter)

storeAlmostNewShepherd

public void storeAlmostNewShepherd(Abraham shep)
Shep has been created, but is not consistent yet. storeNewFlock must be called on it
before the next makeConsistent.


storeInitialFlock

public void storeInitialFlock(Abraham turtle,
                              XcvrMaker protocol,
                              Cookbook cookbook)
A turtle just got created!! Remember it as the initial flock.


storeNewFlock

public void storeNewFlock(Abraham shep)
Shep just got created!! On some later commit, assign it to a snarf
and write it to the disk.


fetchCanonical

public Abraham fetchCanonical(int hash,
                              SnarfID snarfID,
                              int 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 both till we
know that they are actually different objects.


makeReal

public void makeReal(FlockInfo 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.


registerStub

public void registerStub(Abraham shep,
                         SnarfID snarfID,
                         int index)
Called to register a newly created stub (by the diskSpecialist) in the internal
tables. The diskSpecialist in particular calls this when it couldn't find an
already existing stub (with fetchCacnonical) representing the flock at the
particular location.


beginConsistent

public void beginConsistent(IntegerVar dirty)
This is called before entering consistent block. 'dirty' is the block's declaration of
the maximum number of shepherds which it can dirty. If this is a top level consistent
block, the virtual image in memory is now in a consistent state. It may be written to the
disk if necessary.


consistentBlockAt

public void consistentBlockAt(java.lang.String fileName,
                              int lineNo)
This is called after beginConsistent, but before entering a consistent block, for
debugging purposes. Default is to do nothing


endConsistent

public void endConsistent(IntegerVar dirty)
This is called after exiting a consistent block.


insideCommit

public boolean insideCommit()

purge

public void purge()
Flush everything out to disk and remove all purgeable imaged objects from memory.


purgeClean

public void purgeClean(boolean noneLocked)
purge all shepherds that are currently clean, not locked, not dirty, and
purgeable. Purging just turns them into stubs, freeing the rest of their flocks.
Garbage collection can clean up the flocks and any stubs no longer pointed to
by something in memory.


makeConsistent

public void makeConsistent()
The virtual image in memory is now in a consistent state. It may be written to
the disk if necessary.


makeConsistentBegin

public void makeConsistentBegin(IntegerVar dirty)
The virtual image in memory is now in a consistent state. It may be written to the disk if
necessary. This is called before entering a top level consistent block. 'dirty' is the
block's declaration of the maximum number of shepherds which it can dirty.


makeConsistentEnd

public void makeConsistentEnd()
This is called after exiting a top level consistent block.


actualHashForEqual

public int actualHashForEqual()
Overrides:
actualHashForEqual in class Heaper

isFake

public boolean isFake()

flockInfoTable

public void flockInfoTable(PrimPtrTable table)

flockTable

public void flockTable(WeakPtrArray table)

flockInfoTable

public PrimPtrTable flockInfoTable()

flockTable

public WeakPtrArray flockTable()

destruct

public void destruct()
Description copied from class: Heaper
Classes should implement this message rather than a destructor. We use this so
the destruction behavior implemented in abstract superclasses can access the
vtable of the concrete run-time type in C++. Using a message makes C++
parallel the Smalltalk semantics for delete. Destroy will actually call the destructor.

Overrides:
destruct in class Heaper

fluidSpace

public java.lang.String fluidSpace()

fluidSpace

public java.lang.String fluidSpace(java.lang.String aFluidSpace)

initializeDisk

public static DiskManager initializeDisk(java.lang.String fname)
This builds the disk managing structure.


make

public static Heaper make(java.lang.String fname)

emulsion

public static Emulsion emulsion()

cleanupGarbage

public static void cleanupGarbage()
Description copied from class: Heaper
Heaper cleanupGarbage


exitTimeNonInherited

public static void exitTimeNonInherited()

linkTimeNonInherited

public static void linkTimeNonInherited()

staticTimeNonInherited

public static void staticTimeNonInherited()

bomb

public static void bomb(IntegerVar CHARGE)

consistent

public static void consistent(BlockClosure aBlock)
Execute the block inside a pseudo-transaction.


consistent

public static void consistent(IntegerVar dirty,
                              BlockClosure aBlock)
Execute the block inside a pseudo-transaction.


consistent

public static void consistent(IntegerVar dirty,
                              BlockClosure aBlock,
                              Context context)

insistent

public static void insistent(BlockClosure aBlock)
Execute the block inside a pseudo-transaction.


insistent

public static void insistent(IntegerVar dirty,
                             BlockClosure aBlock)
Execute the block inside a pseudo-transaction.


insistent

public static void insistent(IntegerVar dirty,
                             BlockClosure aBlock,
                             Context context)


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