Documentation ¶
Index ¶
- Constants
- Variables
- func GetRandomPort() string
- func InitRepo(conf InitConfig) error
- func MigrateRepo(conf MigrateConfig) error
- type AddFileConfig
- type AddThreadConfig
- type BlockInfo
- type CafeInbox
- type CafeOutbox
- type CafeService
- func (h *CafeService) CheckMessages(cafe peer.ID) error
- func (h *CafeService) DeleteMessages(cafe peer.ID) error
- func (h *CafeService) DeliverMessage(mid string, pid peer.ID, cafe peer.ID) error
- func (h *CafeService) Handle(pid peer.ID, env *pb.Envelope) (*pb.Envelope, error)
- func (h *CafeService) Ping(pid peer.ID) (service.PeerStatus, error)
- func (h *CafeService) Protocol() protocol.ID
- func (h *CafeService) Register(cafe peer.ID) error
- func (h *CafeService) Store(cids []string, cafe peer.ID) ([]string, error)
- func (h *CafeService) StoreThread(thrd *repo.Thread, cafe peer.ID) error
- type ContactInfo
- type Directory
- type InitConfig
- type Keys
- type MigrateConfig
- type NotificationInfo
- type Overview
- type PinResponse
- type Profile
- type RunConfig
- type Textile
- func (t *Textile) AcceptExternalThreadInvite(inviteId string, key []byte) (mh.Multihash, error)
- func (t *Textile) AcceptThreadInvite(inviteId string) (mh.Multihash, error)
- func (t *Textile) AcceptThreadInviteViaNotification(id string) (mh.Multihash, error)
- func (t *Textile) Account() *keypair.Full
- func (t *Textile) AddContact(id string, address string, username string) error
- func (t *Textile) AddFile(mill m.Mill, conf AddFileConfig) (*repo.File, error)
- func (t *Textile) AddNodeFromDirs(dirs []Directory) (ipld.Node, Keys, error)
- func (t *Textile) AddNodeFromFiles(files []repo.File) (ipld.Node, Keys, error)
- func (t *Textile) AddSchema(jsonstr string, name string) (*repo.File, error)
- func (t *Textile) AddThread(sk libp2pc.PrivKey, conf AddThreadConfig) (*Thread, error)
- func (t *Textile) ApiAddr() string
- func (t *Textile) Avatar() (*string, error)
- func (t *Textile) Block(id string) (*repo.Block, error)
- func (t *Textile) BlockInfo(id string) (*BlockInfo, error)
- func (t *Textile) Blocks(offset string, limit int, query string) []repo.Block
- func (t *Textile) BlocksByTarget(target string) []repo.Block
- func (t *Textile) CafeApiAddr() string
- func (t *Textile) CafeSession(peerId string) (*repo.CafeSession, error)
- func (t *Textile) CafeSessions() ([]repo.CafeSession, error)
- func (t *Textile) CheckCafeMessages() error
- func (t *Textile) CloseChns()
- func (t *Textile) Config() *config.Config
- func (t *Textile) Contact(id string) *ContactInfo
- func (t *Textile) ContactThreads(id string) ([]ThreadInfo, error)
- func (t *Textile) ContactUsername(id string) string
- func (t *Textile) Contacts() ([]ContactInfo, error)
- func (t *Textile) CountUnreadNotifications() int
- func (t *Textile) DataAtPath(path string) ([]byte, error)
- func (t *Textile) Decrypt(input []byte) ([]byte, error)
- func (t *Textile) DeregisterCafe(peerId string) error
- func (t *Textile) DoneCh() <-chan struct{}
- func (t *Textile) Encrypt(input []byte) ([]byte, error)
- func (t *Textile) File(hash string) (*repo.File, error)
- func (t *Textile) FileData(hash string) (io.ReadSeeker, *repo.File, error)
- func (t *Textile) GetMedia(reader io.Reader, mill m.Mill) (string, error)
- func (t *Textile) GetThreadUpdateListener() *broadcast.Listener
- func (t *Textile) IgnoreThreadInvite(inviteId string) error
- func (t *Textile) IgnoreThreadInviteViaNotification(id string) error
- func (t *Textile) Ipfs() *core.IpfsNode
- func (t *Textile) LinksAtPath(path string) ([]*ipld.Link, error)
- func (t *Textile) Mobile() bool
- func (t *Textile) NotificationCh() <-chan NotificationInfo
- func (t *Textile) NotificationInfo(note repo.Notification) NotificationInfo
- func (t *Textile) Notifications(offset string, limit int) []NotificationInfo
- func (t *Textile) Online() bool
- func (t *Textile) OnlineCh() <-chan struct{}
- func (t *Textile) Overview() (*Overview, error)
- func (t *Textile) PeerId() (peer.ID, error)
- func (t *Textile) Ping(pid peer.ID) (service.PeerStatus, error)
- func (t *Textile) Profile(pid peer.ID) (*Profile, error)
- func (t *Textile) PublishProfile() error
- func (t *Textile) ReadAllNotifications() error
- func (t *Textile) ReadNotification(id string) error
- func (t *Textile) RefreshCafeSession(peerId string) (*repo.CafeSession, error)
- func (t *Textile) RegisterCafe(peerId string) (*repo.CafeSession, error)
- func (t *Textile) RemoveThread(id string) (mh.Multihash, error)
- func (t *Textile) RepoPath() string
- func (t *Textile) ResolveProfile(name peer.ID) (*path.Path, error)
- func (t *Textile) SetAvatar(hash string) error
- func (t *Textile) SetUsername(username string) error
- func (t *Textile) Sign(input []byte) ([]byte, error)
- func (t *Textile) Start() error
- func (t *Textile) StartApi(addr string)
- func (t *Textile) Started() bool
- func (t *Textile) Stop() error
- func (t *Textile) StopApi() error
- func (t *Textile) TargetNodeKeys(node ipld.Node) (Keys, error)
- func (t *Textile) Thread(id string) *Thread
- func (t *Textile) ThreadByKey(key string) *Thread
- func (t *Textile) ThreadComment(block repo.Block) (*ThreadCommentInfo, error)
- func (t *Textile) ThreadComments(target string) ([]ThreadCommentInfo, error)
- func (t *Textile) ThreadFile(blockId string) (*ThreadFilesInfo, error)
- func (t *Textile) ThreadFiles(offset string, limit int, threadId string) ([]ThreadFilesInfo, error)
- func (t *Textile) ThreadInfo(id string) (*ThreadInfo, error)
- func (t *Textile) ThreadInvites() []ThreadInviteInfo
- func (t *Textile) ThreadLike(block repo.Block) (*ThreadLikeInfo, error)
- func (t *Textile) ThreadLikes(target string) ([]ThreadLikeInfo, error)
- func (t *Textile) ThreadMessage(block repo.Block) (*ThreadMessageInfo, error)
- func (t *Textile) ThreadMessages(offset string, limit int, threadId string) ([]ThreadMessageInfo, error)
- func (t *Textile) Threads() []Thread
- func (t *Textile) UpdateCh() <-chan Update
- func (t *Textile) Username() (*string, error)
- func (t *Textile) Verify(input []byte, sig []byte) error
- func (t *Textile) Writer() io.Writer
- type Thread
- func (t *Thread) AddComment(target string, body string) (mh.Multihash, error)
- func (t *Thread) AddExternalInvite() (mh.Multihash, []byte, error)
- func (t *Thread) AddFiles(node ipld.Node, caption string, keys Keys) (mh.Multihash, error)
- func (t *Thread) AddFlag(block string) (mh.Multihash, error)
- func (t *Thread) AddIgnore(block string) (mh.Multihash, error)
- func (t *Thread) AddInvite(inviteeId peer.ID) (mh.Multihash, error)
- func (t *Thread) AddLike(target string) (mh.Multihash, error)
- func (t *Thread) AddMessage(body string) (mh.Multihash, error)
- func (t *Thread) AddPeer(id string) error
- func (t *Thread) Decrypt(data []byte) ([]byte, error)
- func (t *Thread) Encrypt(data []byte) ([]byte, error)
- func (t *Thread) Head() (string, error)
- func (t *Thread) Info() (*ThreadInfo, error)
- func (t *Thread) Peers() []repo.ThreadPeer
- func (t *Thread) State() (repo.ThreadState, error)
- type ThreadCommentInfo
- type ThreadConfig
- type ThreadFileInfo
- type ThreadFilesInfo
- type ThreadInfo
- type ThreadInviteInfo
- type ThreadLikeInfo
- type ThreadMessageInfo
- type ThreadUpdate
- type ThreadsOutbox
- type ThreadsService
- func (h *ThreadsService) Handle(pid peer.ID, env *pb.Envelope) (*pb.Envelope, error)
- func (h *ThreadsService) NewEnvelope(threadId string, hash mh.Multihash, ciphertext []byte) (*pb.Envelope, error)
- func (h *ThreadsService) Ping(pid peer.ID) (service.PeerStatus, error)
- func (h *ThreadsService) Protocol() protocol.ID
- func (h *ThreadsService) SendMessage(pid peer.ID, env *pb.Envelope) error
- type Update
- type UpdateType
Constants ¶
const CafeServiceProtocol = protocol.ID("/textile/cafe/1.0.0")
const DataLinkName = "d"
const FileLinkName = "f"
const Version = "1.0.0-rc5"
Version is the core version identifier
Variables ¶
var ErrAccountRequired = errors.New("account required")
common errors
var ErrBlockNotFound = errors.New("block not found")
ErrBlockNotFound indicates a block was not found in the index
var ErrBlockWrongType = errors.New("block type is not the type requested")
ErrBlockWrongType indicates a block was requested as a type other than its own
var ErrFileNotFound = errors.New("file not found")
var ErrInvalidFileNode = errors.New("invalid files node")
ErrInvalidFileNode indicates files where added via a nil ipld node
var ErrInvalidThreadBlock = errors.New("invalid thread block")
ErrInvalidThreadBlock is a catch all error for malformed / invalid blocks
var ErrInvitesNotAllowed = errors.New("invites not allowed to private thread")
ErrInvitesNotAllowed indicates an invite was attempted on a private thread
var ErrJsonSchemaRequired = errors.New("thread schema does not allow json files")
ErrJsonSchemaRequired indicates json files where added without a json schema
var ErrMissingDataLink = errors.New("data link not in node")
var ErrMissingFileLink = errors.New("file link not in node")
var ErrOffline = errors.New("node is offline")
var ErrStarted = errors.New("node is started")
var ErrStopped = errors.New("node is stopped")
var ErrThreadInviteNotFound = errors.New("thread invite not found")
ErrThreadInviteNotFound indicates thread invite is not found
var ErrThreadLoaded = errors.New("thread is loaded")
ErrThreadLoaded indicates the thread is already loaded from the datastore
var ErrThreadNotFound = errors.New("thread not found")
ErrThreadNotFound indicates thread is not found in the loaded list
var ErrThreadSchemaRequired = errors.New("thread schema required to add files")
ErrThreadSchemaRequired indicates files where added without a thread schema
Functions ¶
func GetRandomPort ¶
func GetRandomPort() string
GetRandomPort returns a port within the acceptable range
func MigrateRepo ¶
func MigrateRepo(conf MigrateConfig) error
MigrateRepo runs _all_ repo migrations, including major
Types ¶
type AddFileConfig ¶
type AddThreadConfig ¶
type AddThreadConfig struct { Key string `json:"key"` Name string `json:"name"` Schema mh.Multihash `json:"schema"` Initiator string `json:"initiator"` Type repo.ThreadType `json:"type"` Join bool `json:"join"` }
AddThreadConfig is used to create a new thread model
type BlockInfo ¶
type BlockInfo struct { Id string `json:"id"` ThreadId string `json:"thread_id"` AuthorId string `json:"author_id"` Username string `json:"username"` Type string `json:"type"` Date time.Time `json:"date"` Parents []string `json:"parents"` Target string `json:"target,omitempty"` Body string `json:"body,omitempty"` }
BlockInfo is a more readable version of repo.Block
type CafeInbox ¶
type CafeInbox struct {
// contains filtered or unexported fields
}
CafeInbox queues and processes outbound thread messages
func NewCafeInbox ¶
func NewCafeInbox( service func() *CafeService, threadsService func() *ThreadsService, node func() *core.IpfsNode, datastore repo.Datastore, ) *CafeInbox
NewCafeInbox creates a new inbox queue
func (*CafeInbox) Add ¶
func (q *CafeInbox) Add(msg *pb.CafeMessage) error
Add adds an inbound message
func (*CafeInbox) CheckMessages ¶
CheckMessages asks each active cafe session for new messages
type CafeOutbox ¶
type CafeOutbox struct {
// contains filtered or unexported fields
}
CafeOutbox queues and processes outbound cafe requests
func NewCafeOutbox ¶
func NewCafeOutbox(service func() *CafeService, node func() *core.IpfsNode, datastore repo.Datastore) *CafeOutbox
NewCafeOutbox creates a new outbox queue
func (*CafeOutbox) Add ¶
func (q *CafeOutbox) Add(target string, rtype repo.CafeRequestType) error
Add adds a request for each active cafe session
func (*CafeOutbox) InboxRequest ¶
func (q *CafeOutbox) InboxRequest(pid peer.ID, env *pb.Envelope, inboxes []string) error
InboxRequest adds a request for a peer's inbox(es)
type CafeService ¶
type CafeService struct {
// contains filtered or unexported fields
}
CafeService is a libp2p pinning and offline message service
func NewCafeService ¶
func NewCafeService( account *keypair.Full, node *core.IpfsNode, datastore repo.Datastore, inbox *CafeInbox, ) *CafeService
NewCafeService returns a new threads service
func (*CafeService) CheckMessages ¶
func (h *CafeService) CheckMessages(cafe peer.ID) error
CheckMessages asks each session's inbox for new messages
func (*CafeService) DeleteMessages ¶
func (h *CafeService) DeleteMessages(cafe peer.ID) error
DeleteMessages deletes a page of messages from a cafe
func (*CafeService) DeliverMessage ¶
func (h *CafeService) DeliverMessage(mid string, pid peer.ID, cafe peer.ID) error
DeliverMessage delivers a message content id to a peer's cafe inbox TODO: unpin message locally after it's delivered
func (*CafeService) Ping ¶
func (h *CafeService) Ping(pid peer.ID) (service.PeerStatus, error)
Ping pings another peer
func (*CafeService) Protocol ¶
func (h *CafeService) Protocol() protocol.ID
Protocol returns the handler protocol
func (*CafeService) Register ¶
func (h *CafeService) Register(cafe peer.ID) error
Register creates a session with a cafe
func (*CafeService) Store ¶
func (h *CafeService) Store(cids []string, cafe peer.ID) ([]string, error)
Store stores (pins) content on a cafe and returns a list of successful cids
func (*CafeService) StoreThread ¶
func (h *CafeService) StoreThread(thrd *repo.Thread, cafe peer.ID) error
StoreThread pushes a thread to a cafe backup
type ContactInfo ¶
type ContactInfo struct { Id string `json:"id"` Address string `json:"address"` Username string `json:"username"` ThreadIds []string `json:"thread_ids"` Added time.Time `json:"added"` }
ContactInfo display info about a contact
type InitConfig ¶
type InitConfig struct { Account *keypair.Full PinCode string RepoPath string SwarmPorts string ApiAddr string CafeApiAddr string GatewayAddr string IsMobile bool IsServer bool LogLevel logger.Level LogToDisk bool CafeOpen bool }
InitConfig is used to setup a textile node
type MigrateConfig ¶
MigrateConfig is used to define options during a major migration
type NotificationInfo ¶
type NotificationInfo struct { Id string `json:"id"` Date time.Time `json:"date"` ActorId string `json:"actor_id"` Username string `json:"username,omitempty"` Subject string `json:"subject"` SubjectId string `json:"subject_id"` BlockId string `json:"block_id,omitempty"` Target string `json:"target,omitempty"` Type string `json:"type"` Body string `json:"body"` Read bool `json:"read"` }
type Overview ¶
type Overview struct { AccountPeerCount int `json:"account_peer_cnt"` ThreadCount int `json:"thread_cnt"` FileCount int `json:"file_cnt"` ContactCount int `json:"contact_cnt"` }
Overview is a wallet overview object
type PinResponse ¶
PinResponse is the json response from a pin request
type Profile ¶
type Profile struct { Address string `json:"address"` Inboxes []string `json:"inboxes,omitempty"` Username string `json:"username,omitempty"` AvatarUri string `json:"avatar_uri,omitempty"` }
Profile is an account-wide public profile NOTE: any account peer can publish profile entries to the same IPNS key
type Textile ¶
type Textile struct {
// contains filtered or unexported fields
}
Textile is the main Textile node structure
func NewTextile ¶
NewTextile runs a node out of an initialized repo
func (*Textile) AcceptExternalThreadInvite ¶
AcceptExternalThreadInvite attemps to download an encrypted thread key from an external invite, adds a new thread, and notifies the inviter of the join
func (*Textile) AcceptThreadInvite ¶
AcceptThreadInvite adds a new thread, and notifies the inviter of the join
func (*Textile) AcceptThreadInviteViaNotification ¶
AcceptThreadInviteViaNotification uses an invite notification to accept an invite to a thread
func (*Textile) AddContact ¶
AddContact adds a contact for the first time Note: Existing contacts will not be overwritten
func (*Textile) AddNodeFromDirs ¶
func (*Textile) AddNodeFromFiles ¶
func (*Textile) BlocksByTarget ¶
BlocksByTarget returns block with parent
func (*Textile) CafeApiAddr ¶
CafeApiAddr returns the cafe api address
func (*Textile) CafeSession ¶
func (t *Textile) CafeSession(peerId string) (*repo.CafeSession, error)
CafeSession returns an active session by id
func (*Textile) CafeSessions ¶
func (t *Textile) CafeSessions() ([]repo.CafeSession, error)
CafeSessions lists active cafe sessions
func (*Textile) CheckCafeMessages ¶
CheckCafeMessages fetches new messages from registered cafes
func (*Textile) Contact ¶
func (t *Textile) Contact(id string) *ContactInfo
Contact looks up a contact by peer id
func (*Textile) ContactThreads ¶
func (t *Textile) ContactThreads(id string) ([]ThreadInfo, error)
ContactThreads returns all threads with the given peer
func (*Textile) ContactUsername ¶
ContactUsername returns the username for the peer id if known
func (*Textile) Contacts ¶
func (t *Textile) Contacts() ([]ContactInfo, error)
Contacts returns all contacts this peer has interacted with
func (*Textile) CountUnreadNotifications ¶
CountUnreadNotifications counts unread notifications
func (*Textile) DataAtPath ¶
DataAtPath returns raw data behind an ipfs path
func (*Textile) DeregisterCafe ¶
DeregisterCafe removes the session associated with the given cafe
func (*Textile) DoneCh ¶
func (t *Textile) DoneCh() <-chan struct{}
DoneCh returns the core node done channel
func (*Textile) GetThreadUpdateListener ¶
GetThreadUpdateListener returns the thread update channel
func (*Textile) IgnoreThreadInvite ¶
IgnoreThreadInvite deletes the invite and removes the associated notification.
func (*Textile) IgnoreThreadInviteViaNotification ¶
IgnoreThreadInviteViaNotification uses an invite notification to ignore an invite to a thread
func (*Textile) LinksAtPath ¶
LinksAtPath returns ipld links behind an ipfs path
func (*Textile) NotificationCh ¶
func (t *Textile) NotificationCh() <-chan NotificationInfo
NotificationsCh returns the notifications channel
func (*Textile) NotificationInfo ¶
func (t *Textile) NotificationInfo(note repo.Notification) NotificationInfo
NotificationInfo returns the notification info object
func (*Textile) Notifications ¶
func (t *Textile) Notifications(offset string, limit int) []NotificationInfo
Notifications lists notifications
func (*Textile) OnlineCh ¶
func (t *Textile) OnlineCh() <-chan struct{}
OnlineCh returns the online channel
func (*Textile) Ping ¶
func (t *Textile) Ping(pid peer.ID) (service.PeerStatus, error)
Ping pings another peer
func (*Textile) PublishProfile ¶
PublishProfile publishes the current profile
func (*Textile) ReadAllNotifications ¶
ReadAllNotifications marks all notification as read
func (*Textile) ReadNotification ¶
ReadNotification marks a notification as read
func (*Textile) RefreshCafeSession ¶
func (t *Textile) RefreshCafeSession(peerId string) (*repo.CafeSession, error)
RefreshCafeSession attempts to refresh a token with a cafe
func (*Textile) RegisterCafe ¶
func (t *Textile) RegisterCafe(peerId string) (*repo.CafeSession, error)
RegisterCafe registers this account with another peer (the "cafe"), which provides a session token for the service
func (*Textile) RemoveThread ¶
RemoveThread removes a thread
func (*Textile) ResolveProfile ¶
ResolveProfile looks up a profile on ipns
func (*Textile) SetUsername ¶
SetUsername updates profile with a new username
func (*Textile) ThreadByKey ¶
ThreadByKey get a thread by key from loaded threads
func (*Textile) ThreadComment ¶
func (t *Textile) ThreadComment(block repo.Block) (*ThreadCommentInfo, error)
func (*Textile) ThreadComments ¶
func (t *Textile) ThreadComments(target string) ([]ThreadCommentInfo, error)
func (*Textile) ThreadFile ¶
func (t *Textile) ThreadFile(blockId string) (*ThreadFilesInfo, error)
func (*Textile) ThreadFiles ¶
func (*Textile) ThreadInfo ¶
func (t *Textile) ThreadInfo(id string) (*ThreadInfo, error)
ThreadInfo gets thread info
func (*Textile) ThreadInvites ¶
func (t *Textile) ThreadInvites() []ThreadInviteInfo
ThreadInvites lists info on all pending invites
func (*Textile) ThreadLike ¶
func (t *Textile) ThreadLike(block repo.Block) (*ThreadLikeInfo, error)
func (*Textile) ThreadLikes ¶
func (t *Textile) ThreadLikes(target string) ([]ThreadLikeInfo, error)
func (*Textile) ThreadMessage ¶
func (t *Textile) ThreadMessage(block repo.Block) (*ThreadMessageInfo, error)
func (*Textile) ThreadMessages ¶
type Thread ¶
type Thread struct { Id string Key string // app key, usually UUID Name string Type repo.ThreadType Schema *schema.Node // contains filtered or unexported fields }
Thread is the primary mechanism representing a collecion of data / files / photos
func NewThread ¶
func NewThread(model *repo.Thread, conf *ThreadConfig) (*Thread, error)
NewThread create a new Thread from a repo model and config
func (*Thread) AddComment ¶
AddComment adds an outgoing comment block
func (*Thread) AddExternalInvite ¶
AddExternalInvite creates an external invite, which can be retrieved by any peer and does not become part of the hash chain
func (*Thread) AddIgnore ¶
AddIgnore adds an outgoing ignore block targeted at another block to ignore
func (*Thread) AddInvite ¶
AddInvite creates an outgoing invite block, which is sent directly to the recipient and does not become part of the hash chain
func (*Thread) AddMessage ¶
AddMessage adds an outgoing message block
func (*Thread) AddPeer ¶
AddPeer directly adds a peer to a thread Note: This is really just tmp here for the 1.0 migration
func (*Thread) Peers ¶
func (t *Thread) Peers() []repo.ThreadPeer
Peers returns locally known peers in this thread
type ThreadCommentInfo ¶
type ThreadConfig ¶
type ThreadConfig struct { RepoPath string Config *config.Config Node func() *core.IpfsNode Datastore repo.Datastore Service func() *ThreadsService ThreadsOutbox *ThreadsOutbox CafeOutbox *CafeOutbox SendUpdate func(update ThreadUpdate) }
ThreadConfig is used to construct a Thread
type ThreadFileInfo ¶
type ThreadFilesInfo ¶
type ThreadFilesInfo struct { Block string `json:"block"` Target string `json:"target"` Date time.Time `json:"date"` AuthorId string `json:"author_id"` Username string `json:"username,omitempty"` Caption string `json:"caption,omitempty"` Files []ThreadFileInfo `json:"files"` Comments []ThreadCommentInfo `json:"comments"` Likes []ThreadLikeInfo `json:"likes"` Threads []string `json:"threads"` }
type ThreadInfo ¶
type ThreadInfo struct { Id string `json:"id"` Key string `json:"key"` Name string `json:"name"` Schema *schema.Node `json:"schema,omitempty"` SchemaId string `json:"schema_id,omitempty"` Initiator string `json:"initiator"` Type string `json:"type"` State string `json:"state"` Head *BlockInfo `json:"head,omitempty"` PeerCount int `json:"peer_cnt"` BlockCount int `json:"block_cnt"` FileCount int `json:"file_cnt"` }
ThreadInfo reports info about a thread
type ThreadInviteInfo ¶
type ThreadInviteInfo struct { Id string `json:"id"` Name string `json:"name"` Inviter string `json:"inviter"` Date time.Time `json:"date"` }
ThreadInviteInfo reports info about a thread
type ThreadLikeInfo ¶
type ThreadMessageInfo ¶
type ThreadUpdate ¶
type ThreadUpdate struct { Block BlockInfo `json:"block"` ThreadId string `json:"thread_id"` ThreadName string `json:"thread_name"` Info interface{} `json:"info,omitempty"` }
ThreadUpdate is used to notify listeners about updates in a thread
type ThreadsOutbox ¶
type ThreadsOutbox struct {
// contains filtered or unexported fields
}
ThreadsOutbox queues and processes outbound thread messages
func NewThreadsOutbox ¶
func NewThreadsOutbox( service func() *ThreadsService, node func() *core.IpfsNode, datastore repo.Datastore, cafeOutbox *CafeOutbox, ) *ThreadsOutbox
NewThreadsOutbox creates a new outbox queue
type ThreadsService ¶
type ThreadsService struct {
// contains filtered or unexported fields
}
ThreadService is a libp2p service for orchestrating a collection of files with annotations amongst a group of peers
func NewDummyThreadsService ¶
func NewDummyThreadsService(account *keypair.Full, node *core.IpfsNode) *ThreadsService
NewDummyThreadsService is used to create message envelopes _before_ the node is able to go online
func NewThreadsService ¶
func NewThreadsService( account *keypair.Full, node *core.IpfsNode, datastore repo.Datastore, getThread func(id string) *Thread, addThread func(sk libp2pc.PrivKey, conf AddThreadConfig) (*Thread, error), sendNotification func(note *repo.Notification) error, ) *ThreadsService
NewThreadsService returns a new threads service
func (*ThreadsService) NewEnvelope ¶
func (h *ThreadsService) NewEnvelope(threadId string, hash mh.Multihash, ciphertext []byte) (*pb.Envelope, error)
NewEnvelope signs and wraps an encypted block for transport
func (*ThreadsService) Ping ¶
func (h *ThreadsService) Ping(pid peer.ID) (service.PeerStatus, error)
Ping pings another peer
func (*ThreadsService) Protocol ¶
func (h *ThreadsService) Protocol() protocol.ID
Protocol returns the handler protocol
func (*ThreadsService) SendMessage ¶
func (h *ThreadsService) SendMessage(pid peer.ID, env *pb.Envelope) error
SendMessage sends a message to a peer
type Update ¶
type Update struct { Id string `json:"id"` Name string `json:"name"` Type UpdateType `json:"type"` }
Update is used to notify UI listeners of changes
type UpdateType ¶
type UpdateType int
UpdateType indicates a type of node update
const ( // ThreadAdded is emitted when a thread is added ThreadAdded UpdateType = iota // ThreadRemoved is emitted when a thread is removed ThreadRemoved // AccountPeerAdded is emitted when an account peer (device) is added AccountPeerAdded // AccountPeerRemoved is emitted when an account peer (device) is removed AccountPeerRemoved )
Source Files ¶
- account.go
- api.go
- api_blocks.go
- api_cafes.go
- api_comments.go
- api_files.go
- api_invites.go
- api_likes.go
- api_messages.go
- api_mill.go
- api_notifications.go
- api_profile.go
- api_sub.go
- api_swarm.go
- api_threads.go
- blocks.go
- cafe.go
- cafe_api.go
- cafe_inbox.go
- cafe_outbox.go
- cafe_service.go
- config.go
- contacts.go
- files.go
- main.go
- notifications.go
- overview.go
- profile.go
- thread.go
- thread_announces.go
- thread_comments.go
- thread_files.go
- thread_flags.go
- thread_ignores.go
- thread_invites.go
- thread_joins.go
- thread_leaves.go
- thread_likes.go
- thread_merges.go
- thread_messages.go
- thread_service.go
- threads.go
- threads_files.go
- threads_messages.go
- threads_outbox.go