WIP Scaffholding

This commit is contained in:
2026-02-09 12:32:45 +08:00
parent 138825a074
commit 55101752f5
16 changed files with 73 additions and 0 deletions

4
cmd/chron-cli/main.go Normal file
View File

@@ -0,0 +1,4 @@
package main
func main() {
}

1
core/errors.go Normal file
View File

@@ -0,0 +1 @@
package core

25
core/interfaces.go Normal file
View 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
}

View File

12
core/ledger.go Normal file
View 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")
}

View File

27
core/types.go Normal file
View 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
}

View File

View File

View File

View File

View File

2
go.mod
View File

@@ -1,3 +1,5 @@
module git.michelsen.id/chron module git.michelsen.id/chron
go 1.25.5 go 1.25.5
require github.com/google/uuid v1.6.0

2
go.sum Normal file
View File

@@ -0,0 +1,2 @@
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=