Kernel
From Croquet Consortium
Contents |
Kernel Objects
TFarRef
A Croquet specific FarRef. Does not allow immediate messages to pass through automatically. Use only in conjunction with #future or #send, e.g.,
ref := island send avatar. ref future translation: 100@0@100. trans := ref send:[:obj| obj translation]. "<- this will likely NOT be 100@0@100"
TIsland
Current representation for a Croquet island. Currently undergoing changes.
TIslandController
I control an island's execution.
Instance variables:
status <Symbol> A symbol indicating the status of the controller:
#closed - Unconnected
#connecting - Trying to connect to a router
#authenticating - Authenticating a user
#ready - Connected and ready to use.
#invalid - Something went really, really wrong.
log <Stream> A log stream for debug messages.
island <TIsland> The island I am responsible for.
eventQueue <SharedQueue> The shared queue holding the messages for the event loop.
eventLoop <Process> The process handling messages in the queue.
networkQueue <SharedQueue> The queue containing messages from the network.
facets <Dictionary> The facets associated with the controller.
mutex <TMutex> The mutex used to gain exclusive access to an island.
senderID <TObjectID> This controller's sender ID.
TLocalController
An entirely non-replicated, loop-back kind of controller, requiring no network connectivity.
TMessageSend
I am a Croquet message with associated time value, message id, and sequence number.
TMutex
A Mutex is a light-weight MUTual EXclusion object being used when two or more processes need to access a shared resource concurrently. A Mutex grants ownership to a single process and will suspend any other process trying to acquire the mutex while in use. Waiting processes are granted access to the mutex in the order the access was requested.
Instance variables: Semaphore <Semaphore> The (primitive) semaphore used for synchronization. owner <Process> The process owning the mutex.
TMutexSet
A TMutexSet acquires all of the mutexes inside it.
TObject
A base class for dealing with some unpleasantness of registries etc.
Instance variables: myProperties <TObjectProperties> The extra properties for this object.
TObjectID
I represent 128 bit object IDs.
TPromise
I represent a promise being used when a client needs the result of a future message. In that situation the client can use the promise to execute code when the message is actually executed.
Instance variables: myScripts <Array> Cached script registry for delayed execution msgId <TObjectID> The id associated with the message. resolved <Boolean> True if the message has been resolved. result <Object> The result of the promise (often a FarRef) resolver <Block> The code to be executed when the promise completes.
Example:
island := TIsland new. "creates a new island" "creates a promise representing the #new: message" promise := island future new: Point. "code being executed when promise completed" promise whenComplete:[:result| result future x: 1. result future y: 2. ].
Kernel Support
TARC4Cypher
I represent the RC4 stream cypher.
TCryptoRandom
I am a cryptographically strong random number generator. My implementation is based on code found at http://www.cs.berkeley.edu/~daw/rnd/linux-rand.
TFarRefRegistry
A registry for managing TFarRefs
TFileCacheManager
A simple cache manager looking in a particular directory for some cached resource.
Instance variables:
mutex <TMutex> Mutex for concurrent access.
Location <String> Relative uri (using forward slashes) for the cache location.
TLogger
TLogger logs important messages to a file named 'Croquet.log'.
TMessageQueue
I am a message queue sorting elements primarily by their time values and secondarily by their sequence number.
TObjectProperties
I represent some optional state for TObjects which is allocated lazily if needed.
TObjectProxy
I am a serializable name for an object reference.
TSnapshotReader
I am an experimental IslandReader used for replication.
TSnapshotWriter
I am an experimental IslandWriter used for replication.
Kernel Messages
TFutureMaker
I transform messages into future messages.
TMessageData
I represent a single message (datagram).
Instance variables:
receiver <TObjectID> The receiver's id. selector <Symbol> The message selector. arguments <ByteArray> The message arguments (encoded!) sender <TObjectID> The sender's (machine) id. msgId <TObjectID> The id for this message (to be signaled upon completion) time <Float> The time (in seconds) when this message should be run sid <Integer> The sequence id for this message
TMessageEncoder
I encode and decode stuff for TMessageData.
TMessageMaker
I convert messages into future messages.
Kernel Tests
CroquetVMTests
Test suite to verify that the environment that Croquet is running inside of is up to spec.
