TEMPLATE / FREE / MIT EXAMPLE SOURCE
Keepsake
A small idea, safely kept
A tiny editable key/value notebook built directly on DynaCapDB’s durable store.

Take it for a spin.
Select a saved key or edit Key and Value. Save commits; Load rereads; Delete removes the key. Tab changes the focused field.
Extract the Windows download to a writable folder and open database-notebook.exe. Escape closes it. Database examples keep their local data in the working folder.
See how it works.
Put, Get, Delete, commit versions, failure handling, and durable reopen.
A bounded single-line teaching editor with eight visible saved keys. The store itself retains all saved entries.
READ / CHANGE / UNDERSTAND
The whole example is yours.
These are the exact files in the source download. Start with the model, then follow the window’s event loop. Comments explain the decisions.
using dynacap.storage
// This app uses the actual ordered key/value store: no JSON stand-in.
// A failed commit is shown and the store is reopened before further editing.
class Notebook
{
text root
dynacapStore store
text diagnostic="Ready"
Notebook(text root)
{
this.root=root
this.store=OpenDynaCapStore(root,2097152)
if !this.store.healthy
{
this.diagnostic=this.store.diagnostic
}
}
Save(text key,text value) returns bool
{
if Text.Length(key)==0 or Text.Length(key)>120
{
this.diagnostic="Use a key of 1 to 120 bytes"
return false
}
if !this.store.healthy
{
this.diagnostic=this.store.diagnostic
return false
}
if !this.store.Put(key,value) or !CommitDynaCapStore(this.store)
{
this.store=OpenDynaCapStore(this.root,2097152)
this.diagnostic="Commit failed. Reopened durable data."
return false
}
this.diagnostic=Text.Format("Saved / commit {0}",this.store.commitVersion)
return true
}
Erase(text key) returns bool
{
if !this.store.healthy or !this.store.Get(key).found
{
this.diagnostic="Key does not exist"
return false
}
bool okay=this.store.Delete(key) and CommitDynaCapStore(this.store)
this.store=OpenDynaCapStore(this.root,2097152)
this.diagnostic="Deleted"
if !okay
{
this.diagnostic="Delete failed. Reopened durable data."
}
return okay
}
}
