updates to ev and webfinger
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Jon Lundy
2023-05-29 09:48:20 -06:00
parent 7c4c1521fd
commit 5b9b436125
19 changed files with 559 additions and 57 deletions

View File

@@ -0,0 +1,60 @@
package clean
import "encoding"
type EventLog[T, K, C comparable, E any] interface {
EventLog(T) List[K, C, E]
}
type EventStore[T, K, C comparable, E, A any] interface {
Bus[T, K, E]
EventLog[T, K, C, E]
Load(T, A) error
Store(A) error
Truncate(T) error
}
type Event[T, C comparable, V any] struct {
Topic T
Position C
Payload V
}
type codec interface {
encoding.BinaryMarshaler
encoding.BinaryUnmarshaler
}
type aggr = struct{}
type evvent = Event[string, uint64, codec]
type evvee = EventStore[string, string, uint64, evvent, aggr]
type evvesub = Subscription[Event[string, uint64, codec]]
type PAGE = Page[string, string]
type LOG struct{}
var _ List[string, string, evvee] = (*LOG)(nil)
func (*LOG) First(n uint64, after string) ([]PAGE, error) { panic("N/A") }
func (*LOG) Last(n uint64, before string) ([]PAGE, error) { panic("N/A") }
type SUB struct{}
var _ evvesub = (*SUB)(nil)
func (*SUB) Recv() error { return nil }
func (*SUB) Events() []evvent { return nil }
func (*SUB) Close() {}
type EV struct{}
var _ evvee = (*EV)(nil)
func (*EV) Emit(topic string, event evvent) error { panic("N/A") }
func (*EV) EventLog(topic string) List[string, uint64, evvent] { panic("N/A") }
func (*EV) Subscribe(topic string, after uint64) evvesub { panic("N/A") }
func (*EV) Load(topic string, a aggr) error { panic("N/A") }
func (*EV) Store(a aggr) error { panic("N/A") }
func (*EV) Truncate(topic string) error { panic("N/A") }

View File

@@ -0,0 +1,38 @@
package clean
type GPD[K comparable, V any] interface {
Get(...K) ([]V, error)
Put(K, V) error
Delete(K) error
}
type Edge[C, K comparable] struct {
Key K
Kursor C
}
type Page[C, K comparable] struct {
Edges Edge[C, K]
Start C
End C
Next bool
Prev bool
}
type List[K, C comparable, V any] interface {
First(n uint64, after C) ([]Page[C, K], error)
Last(n uint64, before C) ([]Page[C, K], error)
}
type Emitter[T comparable, E any] interface {
Emit(T, E) error
}
type Subscription[E any] interface {
Recv() error
Events() []E
Close()
}
type Subscriber[T comparable, E any] interface {
Subscribe(T, uint64) Subscription[E]
}
type Bus[T, K comparable, E any] interface {
Emitter[T, E]
Subscriber[T, E]
}