Versions in this module Expand all Collapse all v0 v0.2.0 Jan 23, 2024 Changes in this version + const ChainID + const PolicyId + const TokenName + var ErrPromiseCanceled = errors.New("promise canceled") + var RootCmd = cobra.Command + func DumpKey(key *secp256k1.PrivKey) string + func GenReadablesTicket(ctx context.Context, session Session, acp *ACPClient, ids []string) (string, error) + func NewACPQueryClient(addr string) (types.QueryClient, error) + func NewActor() (string, *secp256k1.PrivKey) + func NewPromise[T any](txHash string) (Promise[T], Fulfiller[T]) + type ACPClient struct + var ACPCl *ACPClient + func NewACPClient(nodeGRPCAddr string, listener *TxListener) (ACPClient, error) + func (c *ACPClient) TxCheckAccess(ctx context.Context, session Session, msg *types.MsgCheckAccess) (*Promise[string], error) + func (c *ACPClient) TxCreatePolicy(ctx context.Context, session Session, msg *types.MsgCreatePolicy) (*Promise[string], error) + func (c *ACPClient) TxDeleteRelationship(ctx context.Context, session Session, msg *types.MsgDeleteRelationship) (*Promise[Executed], error) + func (c *ACPClient) TxRegisterObject(ctx context.Context, session Session, msg *types.MsgRegisterObject) (*Promise[Executed], error) + func (c *ACPClient) TxSetRelationship(ctx context.Context, session Session, msg *types.MsgSetRelationship) (*Promise[Executed], error) + type Executed bool + type Fulfiller struct + func NewFulfiller[T any](resultChan chan<- T, errChan chan<- error) Fulfiller[T] + func (f *Fulfiller[T]) Cancel() + func (f *Fulfiller[T]) Produce(value T) + func (f *Fulfiller[T]) ProduceErr(err error) + type Note struct + Body string + Creator string + LastEditor string + Title string + type NoteCommands struct + var NoteCmds *NoteCommands + func NewNoteCommands(repo Repository, manager *PermissionManager) NoteCommands + func (c *NoteCommands) Create(ctx context.Context, session Session, title string, body string) (Note, error) + type NoteQuerier struct + var Querier *NoteQuerier + func NewNoteQuerier(acp *ACPClient, repo Repository, querier types.QueryClient) NoteQuerier + func (q *NoteQuerier) FetchLocalNodes(ctx context.Context, session Session) ([]Note, error) + func (q *NoteQuerier) FetchReadableNotes(ctx context.Context, session Session) ([]Note, error) + func (q *NoteQuerier) ListReadableNotesID(ctx context.Context, session Session) ([]string, error) + type PermissionManager struct + var PermMan *PermissionManager + func NewPermissionManager(acp *ACPClient) *PermissionManager + func (m *PermissionManager) RegisterNote(ctx context.Context, session Session, note *Note) (*Promise[Executed], error) + func (m *PermissionManager) ShareNote(ctx context.Context, session Session, noteId string, actorId string) (*Promise[Executed], error) + func (m *PermissionManager) UnshareNote(ctx context.Context, session Session, noteId string, actorId string) (*Promise[Executed], error) + type PipeChan struct + func NewPipe[T any, U any](mapper func(T) U, producer <-chan T) PipeChan[T, U] + func (c *PipeChan[T, U]) ReceiveEnd() <-chan U + type Promise struct + func MapPromise[T any, U any](promise Promise[T], mapper func(T) U) Promise[U] + func (p *Promise[T]) Await() (T, error) + func (p *Promise[T]) Error() <-chan error + func (p *Promise[T]) GetResult() (T, error) + func (p *Promise[T]) GetTxHash() string + func (p *Promise[T]) Result() <-chan T + func (p *Promise[T]) Terminated() bool + type Repository interface + GetNote func(ctx context.Context, session Session, ticket string, id string) (Note, error) + ListLocalNotes func(ctx context.Context, actorId string) ([]Note, error) + SetNote func(ctx context.Context, session Session, note *Note) error + type SQLite struct + func NewSQLite(path string) (*SQLite, error) + func (s *SQLite) GetNote(ctx context.Context, session Session, ticket string, id string) (Note, error) + func (s *SQLite) Init() error + func (s *SQLite) ListLocalNotes(ctx context.Context, actorId string) ([]Note, error) + func (s *SQLite) SetNote(ctx context.Context, session Session, note *Note) error + type Session struct + Actor string + PrivKey cryptotypes.PrivKey + func NewSession(key string) Session + type TxError struct + func NewTxError(txHash string, code uint32, msg string, codespace string) *TxError + func (e *TxError) Error() string + type TxListener struct + func NewTxListener(addr string) (*TxListener, error) + func NewTxListenerFromClient(client *rpcclient.WSClient) (*TxListener, error) + func (l *TxListener) DefaultChan() <-chan rpctypes.ResultEvent + func (l *TxListener) ErrChan() <-chan error + func (l *TxListener) Listen(ctx context.Context) error + func (l *TxListener) Subscribe(txHash string) Promise[rpctypes.ResultEvent]