ORIGIN '~beta/basiclib/betaenv' (*
* COPYRIGHT
* Copyright Mjolner Informatics, 1992-98
* All rights reserved.
*)
;
INCLUDE '~beta/basiclib/directory'
'~beta/basiclib/external'
'~beta/basiclib/directory'
'~beta/sysutils/objinterface'
'~beta/containers/list';
BODY 'private/psbody';
-- lib: Attributes --
(* PSEXCEPTION
* ===========
*
* PSexception is used in several exceptional situations where the files
* making up an persistent store are not accessable. The fullName parameter
* is the full path of the directory expected to be a persistent store. *)
PSexception: exception (# fullName: ^Text; enter fullName[] do INNER #);
PSroot:
(# name: ^text; type: ##object; obj: ^Object
enter (name[],type##,obj[])
#);
PSrootsList: list (# element:: PSroot #);
(* PERSISTENTSTORE
* ===============
*)
persistentstore:
(#
<<SLOT PSlib:Attributes>>;
PSroots: ^PSrootsList;
PSstoreID: @integer;
assertOpen:
(#
notOpen:< PSException
(#
...
#);
...
#);
assertInit:
(#
notInitialized:< PSException
(# ... #);
...
#);
numberOfUpdates:
(# result: @integer ... exit result #);
lastupdate: @integer;
hostName: (# exit 'localhost' #);
openCrossStoreItem: ^openpstore;
UNKNOWNTAG: (# exit 0 #);
rebinderItem: ^rebindSpecialReference;
rebindSpecialReference:<(#
target: ^Object;
toSpecialObject:<
(#
objectTag: @integer;
NotHandled:< PSException
(# ... #)
enter objectTag
do INNER
#);
toSpecialType:<
(# typeTag: @integer
enter typeTag
do INNER
#);
objectTag,typeTag: @integer
enter (objectTag,typeTag)
...
exit target[]
#);
commit: assertInit
(#
doUpdateInMemoryObjects:< BooleanValue
(# do false->value; INNER #);
doCheckpoint:< BooleanValue (# do true->value; INNER #);
do INNER
#);
reget: assertInit
(#
NotFound:< PSException (# ... #);
theObject: ^Object;
enter theObject[]
do INNER
#);
init: (# ... #);
create: assertInit
(#
alreadyOpen:< PSexception
(# ... #);
exists:< PSexception
(* The old store is deleted if exists returns.
*) (# ... #);
creationError:< PSexception
(#
...
#);
name: ^Text;
enter name[]
...
#);
abstractOpenOperation: assertInit
(#
alreadyOpenMessage:<
(# msg: ^text
do INNER
exit msg[]
#);
notFoundMessage:<
(# msg: ^text
do INNER
exit msg[]
#);
accessErrorMessage:<
(# msg: ^text
do INNER
exit msg[]
#);
alreadyOpen:< PSexception
(#
...
#);
notFound:< PSexception (# ... #);
accessError:< PSexception
(# ... #);
name: ^Text;
openFunc:<
(#
host,path: [1] @Char;
rcode: @integer
enter (host,path)
do INNER
exit rcode
#)
enter name[]
...
#);
openRead: abstractOpenOperation
(#
alreadyOpenMessage::
(# ... #);
notFoundMessage::
(#
...
#);
accessErrorMessage::
(# ... #);
openFunc::
(#
...
#);
do INNER
#);
openWrite: abstractOpenOperation
(#
alreadyOpenMessage::
(# ... #);
notFoundMessage::
(#
...
#);
accessErrorMessage::
(# ... #);
openFunc::
(#
...
#);
do INNER
#);
checkpoint: assertInit (# ... #);
close: assertInit
(#
danglersExists:<
(#
toDo: @Integer;
kill: (# exit 0 #);
(* Kill the process. Default action. *)
fetch: (# exit 1 #);
(* Fetch the missing objects. *)
ignore: (# exit 2 #);
(* Ignore the dangling references. *)
do kill->toDo; INNER
exit toDo
#);
doCheckpoint:< BooleanValue (# do false->value; INNER #);
...
#);
get: assertInit
(#
quaError:< Exception
(# ... #);
notFound:<
Exception (# ... #);
name: ^Text;
type: ##Object;
theObject: ^Object;
enter (name[],type##)
...
exit theObject[]
#);
ALREADYTHEREERROR: (# exit 6 #);
HASOVERWRITTENERROR: (# exit 7 #);
put: assertInit
(#
AlreadyThere:< PSexception
(#
...
#);
HasOverWritten:< PSexception
(# ... #);
dooverwrite:< BooleanValue
(#
do true->value; INNER
#);
obj: ^Object;
name: ^text;
enter (obj[],name[])
...
#);
scanRootNames: assertInit
(# current: ^Text;
do
PSroots.scan
(# do current.name[]->THIS(scanRootNames).current[] #);
INNER
#);
registerSpecialObject: assertInit
(#
alreadyThere:< Exception
(# ... #);
name: ^Text;
type: ##Object;
enter (name[],type##)
...
#);
registerRuntimeType: assertInit
(# type: ##Object
enter type##
do
'registerRuntimeType: This function is not implemented in the new'
->screen.putLine;
'persistent store, and the call should be removed.'->screen.putLine;
#);
allowLazyFetch:<
BooleanValue;
maxCountOnDanglerHit:< IntegerValue (# do 100->value; INNER #);
OnDanglerHit:< Object;
AfterDanglerHit:<
(# theObject: ^Object; enter theObject[] do INNER #);
openpstore:<
(# psname: ^Text; ps: ^persistentstore;
enter psname[]
do INNER
exit ps[]
#);
deletePersistentStore: assertInit
(#
alreadyOpen:< PSexception
(# ... #);
accessError:< PSexception
(#
...
#);
notFound:< PSexception (# ... #);
name: ^Text;
storeDir: @directory;
enter name[]
...
#);
registerSpecialInstance: assertInit
(#
quaError:< Exception
(# ... #);
notFound:< Exception
(#
...
#);
o: ^Object;
tag: @integer;
(* The arguments to 'RegisterSpecialInstance' is now no longer
* an object and a name, but an object and an 8 bit integer value.
* The integer tag will be the id of the special object.
*)
enter (o[],tag)
...
#);
do INNER ;
#)
| 9.1 Persistentstore Interface | © 1991-2004 Mjølner Informatics |
[Modified: Thursday November 22nd 2001 at 13:33]
|