WIP Scaffholding
This commit is contained in:
4
cmd/chron-cli/main.go
Normal file
4
cmd/chron-cli/main.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package main
|
||||
|
||||
func main() {
|
||||
}
|
||||
1
core/errors.go
Normal file
1
core/errors.go
Normal file
@@ -0,0 +1 @@
|
||||
package core
|
||||
25
core/interfaces.go
Normal file
25
core/interfaces.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
)
|
||||
|
||||
type EntryStore interface {
|
||||
Append(ctx context.Context, entry Entry) (EntryID, error)
|
||||
|
||||
Redact(ctx context.Context, entryID EntryID) error
|
||||
|
||||
Get(ctx context.Context, entryID EntryID) (Entry, error)
|
||||
|
||||
ScanForwards(ctx context.Context, entryID EntryID) ([]EntryID, error)
|
||||
ScanBackwards(ctx context.Context, entryID EntryID) ([]EntryID, error)
|
||||
|
||||
Head(ctx context.Context, ledgerID LedgerID) (EntryID, error)
|
||||
IsEmpty(ctx context.Context, ledgerID LedgerID) bool
|
||||
}
|
||||
|
||||
type PayloadStore interface {
|
||||
Put(ctx context.Context, reader io.Reader) (PayloadID, error)
|
||||
Delete(ctx context.Context, payloadID PayloadID) error
|
||||
}
|
||||
12
core/ledger.go
Normal file
12
core/ledger.go
Normal file
@@ -0,0 +1,12 @@
|
||||
package core
|
||||
|
||||
type Ledger struct {
|
||||
entryStore EntryStore
|
||||
payloadStore PayloadStore
|
||||
|
||||
LedgerID LedgerID
|
||||
}
|
||||
|
||||
func NewLedger(entryStore EntryStore, payloadStore PayloadStore) (*Ledger, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
27
core/types.go
Normal file
27
core/types.go
Normal file
@@ -0,0 +1,27 @@
|
||||
package core
|
||||
|
||||
import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type LedgerID [16]byte
|
||||
|
||||
type EntryID [16]byte
|
||||
type PayloadID [16]byte
|
||||
|
||||
type Hash [32]byte
|
||||
|
||||
type Entry struct {
|
||||
EntryID EntryID
|
||||
|
||||
LedgerID LedgerID
|
||||
Seq uint64
|
||||
|
||||
Timestamp time.Time
|
||||
|
||||
Nonce [16]byte
|
||||
Commitment Hash
|
||||
|
||||
PreviousHash Hash
|
||||
EntryHash Hash
|
||||
}
|
||||
2
go.mod
2
go.mod
@@ -1,3 +1,5 @@
|
||||
module git.michelsen.id/chron
|
||||
|
||||
go 1.25.5
|
||||
|
||||
require github.com/google/uuid v1.6.0
|
||||
|
||||
Reference in New Issue
Block a user