Created
July 30, 2021 23:59
-
-
Save stevegt/53dc0afca2e7130b652e156d3fbddc74 to your computer and use it in GitHub Desktop.
sketch of journal engine API
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package tjournal | |
import ( | |
"fmt" | |
) | |
// XXX get this from pitbase | |
type Addr string | |
// type Input fmt.Stringer | |
// type Output fmt.Stringer | |
// these are better; O(1) performance | |
type Input Addr | |
type Output Addr | |
type Statement fmt.Stringer | |
type Generator interface { | |
Generate(Input, Journal, Checkpoint) (Statement, error) | |
} | |
type Tester interface { | |
Test(Journal, Journal) (Checkpoint, error) | |
} | |
type Publisher interface { | |
Publish(Journal, Checkpoint) error | |
} | |
// XXX shouldn't these be Journaler and Checkpointer, so that we can | |
// plug in pitbase or any other db? | |
type Journal interface { | |
// XXX | |
} | |
type Checkpoint interface { | |
// XXX | |
} | |
// XXX do we need a State interface type, or is that just the | |
// Checkpoint? | |
// XXX think through recursion/mutex -- see https://bit.ly/3ioWZYl |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment