thoughtstream

package
v0.0.0-...-7b96089 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 30, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentLog

type AgentLog struct {
	*os.File
	// contains filtered or unexported fields
}

func NewAgentLog

func NewAgentLog(name string) *AgentLog

func (*AgentLog) Message

func (l *AgentLog) Message(msg Thought)

func (*AgentLog) Print

func (l *AgentLog) Print(str string)

func (*AgentLog) Printf

func (l *AgentLog) Printf(str string, args ...any)

func (*AgentLog) Println

func (l *AgentLog) Println(str string)

type Branch

type Branch interface {
	psi.Node

	Iterable
	ParentBranch() Branch
	Base() *Thought
	Head() *Thought

	ParentPointer() Pointer
	BasePointer() Pointer
	HeadPointer() Pointer

	Interval() Interval

	Stream() Stream
	Mutate() MutableStream

	Fork(options ...ForkOption) MutableStream

	Len() int
}

func NewBranchFromSlice

func NewBranchFromSlice(parent Branch, basePtr Pointer, items ...*Thought) Branch

type CommHandle

type CommHandle struct {
	ID   string
	Name string
	Role msn.Role
}

type ForkOption

type ForkOption func(*ForkOptions)

type ForkOptions

type ForkOptions struct {
}

func NewForkOptions

func NewForkOptions(opts ...ForkOption) ForkOptions

type Interval

type Interval struct {
	Start Pointer
	End   Pointer
}

func (Interval) CompareTo

func (i Interval) CompareTo(other Interval) int

type Iterable

type Iterable = iterators.Iterable[*Thought]

type Iterator

type Iterator = iterators.Iterator[*Thought]

type Manager

type Manager struct {
	psi.NodeBase
	// contains filtered or unexported fields
}

func NewManager

func NewManager(g *graphstore.IndexedGraph, basePath string) *Manager

func (*Manager) Close

func (m *Manager) Close() error

func (*Manager) GetOrCreateBranch

func (m *Manager) GetOrCreateBranch(name string) (branch Branch, err error)

func (*Manager) GetOrCreateStream

func (m *Manager) GetOrCreateStream(name string) (log *ThoughtLog, err error)

func (*Manager) PsiNodeName

func (m *Manager) PsiNodeName() string

type MergeOption

type MergeOption func(*MergeOptions)

type MergeOptions

type MergeOptions struct {
}

func NewMergeOptions

func NewMergeOptions(opts ...MergeOption) MergeOptions

type MergeStrategy

type MergeStrategy interface {
	Apply(ctx context.Context, s MutableStream, streams ...Stream) (Iterator, error)
}

type MergeStrategyFunc

type MergeStrategyFunc func(ctx context.Context, s MutableStream, streams ...Stream) (Iterator, error)

func FlatTimeMergeStrategy

func FlatTimeMergeStrategy() MergeStrategyFunc

func HierarchicalTimeMergeStrategy

func HierarchicalTimeMergeStrategy(r Resolver) MergeStrategyFunc

func (MergeStrategyFunc) Apply

func (f MergeStrategyFunc) Apply(ctx context.Context, s MutableStream, streams ...Stream) (Iterator, error)

type MutableStream

type MutableStream interface {
	Stream

	Append(t *Thought)

	Merge(ctx context.Context, r Resolver, strategy MergeStrategy, branches ...Branch) error
}

type Pointer

type Pointer struct {
	Parent    string
	Previous  string
	Timestamp time.Time
	Level     int64
	Clock     int64
}
func Head() Pointer

func RootPointer

func RootPointer() Pointer

func (Pointer) Address

func (p Pointer) Address() cid.Cid

func (Pointer) CompareTo

func (p Pointer) CompareTo(other Pointer) int

func (Pointer) IsChildOf

func (p Pointer) IsChildOf(other Pointer) bool

func (Pointer) IsHead

func (p Pointer) IsHead() bool

func (Pointer) IsParentOf

func (p Pointer) IsParentOf(other Pointer) bool

func (Pointer) IsRoot

func (p Pointer) IsRoot() bool

func (Pointer) IsSiblingOf

func (p Pointer) IsSiblingOf(other Pointer) bool

func (Pointer) IsZero

func (p Pointer) IsZero() bool

func (Pointer) Less

func (p Pointer) Less(other Pointer) bool

func (Pointer) Next

func (p Pointer) Next() Pointer

func (Pointer) String

func (p Pointer) String() string

type Reference

type Reference struct {
	Path psi.Path
}

type Repo

type Repo struct {
}

type Resolver

type Resolver interface {
	ResolveThought(ctx context.Context, id cid.Cid) (*Thought, error)
	ResolveBranch(ctx context.Context, id cid.Cid) (Branch, error)
}

type Stream

type Stream interface {
	Iterator
	Iterable

	Previous() bool
	Reversed() Stream

	Pointer() Pointer
	Thought() *Thought

	LA(n int) *Thought
	Peek() *Thought
	Seek(p Pointer) error
	Slice(from, to Pointer) Stream

	Fork(options ...ForkOption) MutableStream

	AsBranch() Branch
}

func NewHierarchicalStream

func NewHierarchicalStream(branch Branch) Stream

type ThoughLogListener

type ThoughLogListener func(msg *Thought)

type Thought

type Thought struct {
	psi.NodeBase

	Pointer Pointer
	From    CommHandle
	Text    string

	ReplyTo *CommHandle
}

func NewThought

func NewThought() *Thought

func (*Thought) Clone

func (t *Thought) Clone() *Thought

func (*Thought) NextThought

func (t *Thought) NextThought() *Thought

func (*Thought) PreviousThought

func (t *Thought) PreviousThought() *Thought

type ThoughtLog

type ThoughtLog struct {
	psi.NodeBase
	// contains filtered or unexported fields
}

func NewThoughtLog

func NewThoughtLog(manager *Manager, name string, basePath string) (*ThoughtLog, error)

func (*ThoughtLog) BeginNext

func (cl *ThoughtLog) BeginNext() *Thought

func (*ThoughtLog) Close

func (cl *ThoughtLog) Close() error

func (*ThoughtLog) EpochBarrier

func (cl *ThoughtLog) EpochBarrier()

func (*ThoughtLog) ForkTemporary

func (cl *ThoughtLog) ForkTemporary() *ThoughtLog

func (*ThoughtLog) GC

func (cl *ThoughtLog) GC() error

func (*ThoughtLog) Messages

func (cl *ThoughtLog) Messages() []*Thought

func (*ThoughtLog) MessagesIterator

func (cl *ThoughtLog) MessagesIterator() iterators.Iterator[*Thought]

func (*ThoughtLog) Name

func (cl *ThoughtLog) Name() string

func (*ThoughtLog) PsiNodeName

func (cl *ThoughtLog) PsiNodeName() string

func (*ThoughtLog) Push

func (cl *ThoughtLog) Push(m *Thought) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL