Documentation ¶
Index ¶
- Variables
- func AddMessage(body string, author string, clientTime time.Time, ds datas.Dataset) (datas.Dataset, error)
- func GetAuthors(ds datas.Dataset) []string
- func GetTerms(m Message) []string
- func IndexNewMessage(vrw types.ValueReadWriter, root *Root, m Message)
- func InitDatabase(ds datas.Dataset) (datas.Dataset, error)
- func ListMessages(ds datas.Dataset, searchIds *types.Map, doneChan chan struct{}) (msgMap types.Map, mc chan types.String, err error)
- func NewDataPager(ds datas.Dataset, mkChan chan types.String, doneChan chan struct{}, ...) *dataPager
- func NewLogger(username string) *log.Logger
- func ProcessChatEvents(node *core.IpfsNode, ds datas.Dataset, events chan ChatEvent, t *TermUI, ...)
- func Publish(node *core.IpfsNode, cInfo ClientInfo, h hash.Hash)
- func ReceiveMessages(node *core.IpfsNode, events chan ChatEvent, cInfo ClientInfo)
- func RunImport(dir, dsSpec string) error
- func SearchIndex(ds datas.Dataset, search []string) types.Map
- func TermsFromString(s string) []string
- type ChatEvent
- type ChatEventType
- type ClientInfo
- type EventDelegate
- type IPFSEventDelegate
- func (d IPFSEventDelegate) GenMessageData(cInfo ClientInfo, h hash.Hash) string
- func (d IPFSEventDelegate) HashFromMsgData(msgData string) (hash.Hash, error)
- func (d IPFSEventDelegate) PinBlocks(node *core.IpfsNode, sourceDB, sinkDB datas.Database, sourceCommit types.Value)
- func (d IPFSEventDelegate) SourceCommitFromMsgData(db datas.Database, msgData string) (datas.Database, types.Value)
- type Message
- type P2PEventDelegate
- func (d P2PEventDelegate) GenMessageData(cInfo ClientInfo, h hash.Hash) string
- func (d P2PEventDelegate) HashFromMsgData(msgData string) (hash.Hash, error)
- func (d P2PEventDelegate) PinBlocks(node *core.IpfsNode, sourceDB, sinkDB datas.Database, sourceCommit types.Value)
- func (d P2PEventDelegate) SourceCommitFromMsgData(db datas.Database, msgData string) (datas.Database, types.Value)
- type Root
- type TermIndex
- type TermIndexEditor
- type TermUI
- func (t *TermUI) Close()
- func (t *TermUI) Layout() error
- func (t *TermUI) ResetAuthors(ds datas.Dataset)
- func (t *TermUI) UpdateMessages(ds datas.Dataset, filterIds *types.Map, terms []string) error
- func (t *TermUI) UpdateMessagesAsync(ds datas.Dataset, sids *types.Map, terms []string)
- func (t *TermUI) UpdateMessagesFromSync(ds datas.Dataset)
Constants ¶
This section is empty.
Variables ¶
View Source
var (
PubsubUser = "default"
)
Functions ¶
func AddMessage ¶
func GetAuthors ¶
func IndexNewMessage ¶
func IndexNewMessage(vrw types.ValueReadWriter, root *Root, m Message)
func ListMessages ¶
func NewDataPager ¶
func ProcessChatEvents ¶
func ProcessChatEvents(node *core.IpfsNode, ds datas.Dataset, events chan ChatEvent, t *TermUI, cInfo ClientInfo)
ProcessChatEvent reads events from the event channel and processes them sequentially. Is ClientInfo.IsDaemon is true, it also publishes the current head of the dataset continously.
func Publish ¶
func Publish(node *core.IpfsNode, cInfo ClientInfo, h hash.Hash)
Publish asks the delegate to format a hash/ClientInfo into a suitable msg and publishes that using IPFS pubsub.
func ReceiveMessages ¶
func ReceiveMessages(node *core.IpfsNode, events chan ChatEvent, cInfo ClientInfo)
RecieveMessages listens for messages sent by other chat nodes. It filters out any msgs that have already been received and adds events to teh events channel for any msgs that it hasn't seen yet.
func TermsFromString ¶
Types ¶
type ChatEvent ¶
type ChatEvent struct { EventType ChatEventType Event string }
type ChatEventType ¶
type ChatEventType string
const ( InputEvent ChatEventType = "input" SearchEvent ChatEventType = "search" SyncEvent ChatEventType = "sync" QuitEvent ChatEventType = "quit" )
type ClientInfo ¶
type EventDelegate ¶
type EventDelegate interface { PinBlocks(node *core.IpfsNode, sourceDB, sinkDB datas.Database, sourceCommit types.Value) SourceCommitFromMsgData(db datas.Database, msgData string) (datas.Database, types.Value) HashFromMsgData(msgData string) (hash.Hash, error) GenMessageData(cInfo ClientInfo, h hash.Hash) string }
type IPFSEventDelegate ¶
type IPFSEventDelegate struct{}
func (IPFSEventDelegate) GenMessageData ¶
func (d IPFSEventDelegate) GenMessageData(cInfo ClientInfo, h hash.Hash) string
func (IPFSEventDelegate) HashFromMsgData ¶
func (d IPFSEventDelegate) HashFromMsgData(msgData string) (hash.Hash, error)
func (IPFSEventDelegate) SourceCommitFromMsgData ¶
type P2PEventDelegate ¶
type P2PEventDelegate struct{}
func (P2PEventDelegate) GenMessageData ¶
func (d P2PEventDelegate) GenMessageData(cInfo ClientInfo, h hash.Hash) string
func (P2PEventDelegate) HashFromMsgData ¶
func (d P2PEventDelegate) HashFromMsgData(msgData string) (hash.Hash, error)
func (P2PEventDelegate) SourceCommitFromMsgData ¶
type TermIndex ¶
func NewTermIndex ¶
func NewTermIndex(vrw types.ValueReadWriter, TermDocs types.Map) TermIndex
func (TermIndex) Edit ¶
func (ti TermIndex) Edit() *TermIndexEditor
type TermIndexEditor ¶
type TermIndexEditor struct {
// contains filtered or unexported fields
}
func (*TermIndexEditor) Insert ¶
func (te *TermIndexEditor) Insert(term string, v types.Value) *TermIndexEditor
Indexes |v| by |term|
func (*TermIndexEditor) InsertAll ¶
func (te *TermIndexEditor) InsertAll(terms []string, v types.Value) *TermIndexEditor
Indexes |v| by each unique term in |terms| (tolerates duplicate terms)
type TermUI ¶
func CreateTermUI ¶
func (*TermUI) ResetAuthors ¶
func (*TermUI) UpdateMessages ¶
func (*TermUI) UpdateMessagesAsync ¶
func (*TermUI) UpdateMessagesFromSync ¶
Click to show internal directories.
Click to hide internal directories.