C H A P T E R 1 2
Special-Purpose Objects for Data Storage and Retrieval
About Special-Purpose Storage Objects
// create new mock entry w/ no cached frame
local m := NewMockEntry(myHandler, nil);
// referencing m doesn't create cached frame
local x := m;
// either statement could invoke myHandler:EntryAccess()
local a := x.foo;
local b := m.foo;
To almost all of the system, the mock entry appears to be a normal soup entry;
m.baz := 42
adds a slot to the
frame and this modified
frame is returned the next time the mock entry is accessed.
global function can determine that
is a mock entry,
rather than a soup entry. Note that the
both mock entries and normal soup entries.
Mock Stores, Mock Soups, and Mock Cursors
The current implementation of the Newton object system provides only mock
entries; you must implement appropriate mock cursors, mock soups, and mock
stores as required.
The mock store is a frame you supply which responds appropriately to all the
messages that might normally be sent to a store object. For example, when the
method is invoked, it should return a mock soup.
The mock soup is a frame you supply which responds appropriately to all the
messages that might normally be sent to a soup object. For example, when the
method is called, the mock soup should return a mock cursor.
Mock soups cannot participate in union soups; however, you can implement your
own mock union soup objects that manage the interaction of your mock soups with
normal soups or union soups.
A mock cursor is a frame you supply that can respond appropriately to all the
messages that might normally be sent to a cursor object. For example, when the
method is invoked, it should return a mock entry.