Documentation
¶
Index ¶
- Constants
- Variables
- func AccountRepoExists(baseRepoPath string, accountAddress string) bool
- func ConvertHeadersToCorsOptions(headers config.HTTPHeaders) cors.Options
- func FeedItemType(item *pb.FeedItem) (pb.Block_BlockType, error)
- func GetRandomPort() string
- func InitRepo(conf InitConfig) error
- func IsCafe(p *pb.Peer) bool
- func IsShadow(p *pb.Peer) bool
- func Max(x, y int) int
- func MigrateRepo(conf MigrateConfig) error
- func RepoExists(repoPath string) bool
- func SetCafe(p *pb.Peer)
- func SetShadow(p *pb.Peer)
- type AddFileConfig
- type BlockDownloads
- type BlockOutbox
- type CafeError
- type CafeInbox
- type CafeOutbox
- type CafeOutboxHandler
- type CafeRequestOption
- type CafeRequestSettings
- type CafeService
- func (h *CafeService) CafeFindIpfsAddr(query *pb.IpfsQuery, cafeId string) (*pb.IpfsQueryResult, error)
- func (h *CafeService) CheckMessages(cafeId string) error
- func (h *CafeService) DeleteMessages(cafeId string) error
- func (h *CafeService) Deregister(cafeId string) error
- func (h *CafeService) DiscoverPeers(cafeId string) ([]string, error)
- func (h *CafeService) Flush()
- func (h *CafeService) Handle(env *pb.Envelope, pid peer.ID) (*pb.Envelope, error)
- func (h *CafeService) HandleStream(env *pb.Envelope, pid peer.ID) (chan *pb.Envelope, chan error, chan interface{})
- func (h *CafeService) Ping(pid peer.ID) (service.PeerStatus, error)
- func (h *CafeService) Protocol() protocol.ID
- func (h *CafeService) PublishPeer(peer *pb.Peer, cafeId string) error
- func (h *CafeService) PublishSyncFile(file *pb.SyncFile, cafeId string) error
- func (h *CafeService) PublishVideo(video *pb.Video, cafeId string, store bool) error
- func (h *CafeService) PublishVideoChunk(vchunk *pb.VideoChunk, cafeId string) error
- func (h *CafeService) Register(cafeId string, token string) (*pb.CafeSession, error)
- func (h *CafeService) Search(query *pb.Query, cafeId string, reply func(*pb.QueryResult), ...) error
- func (h *CafeService) Start()
- type ErrStreamAlreadyExist
- type ErrStreamNotExist
- type FeedItemPayload
- type InitConfig
- type MigrateConfig
- type RunConfig
- type Textile
- func (t *Textile) AcceptExternalInvite(id string, key []byte) (mh.Multihash, error)
- func (t *Textile) AcceptInvite(id string) (mh.Multihash, error)
- func (t *Textile) AcceptInviteViaNotification(id string) (mh.Multihash, error)
- func (t *Textile) Account() *keypair.Full
- func (t *Textile) AccountContact() *pb.Contact
- func (t *Textile) AccountProfile() *pb.User
- func (t *Textile) AccountThread() *Thread
- func (t *Textile) AddContact(card *pb.Contact) error
- func (t *Textile) AddData(data []byte, pin bool, hashOnly bool) (string, error)
- func (t *Textile) AddExternalInvite(threadId string) (*pb.ExternalInvite, error)
- func (t *Textile) AddFileIndex(mill m.Mill, conf AddFileConfig) (*pb.FileIndex, error)
- func (t *Textile) AddInvite(threadId string, address string) error
- func (t *Textile) AddNodeFromDirs(dirs *pb.DirectoryList) (ipld.Node, *pb.Keys, error)
- func (t *Textile) AddNodeFromFiles(files []*pb.FileIndex) (ipld.Node, *pb.Keys, error)
- func (t *Textile) AddOrUpdateThread(thread *pb.Thread) error
- func (t *Textile) AddPeer(peer *pb.Peer) error
- func (t *Textile) AddSchema(jsonstr string, name string) (*pb.FileIndex, error)
- func (t *Textile) AddSimpleDirectory(path string, threadId string) (*pb.Block, error)
- func (t *Textile) AddSimpleFile(path string, threadId string) (*pb.Block, error)
- func (t *Textile) AddSimplePicture(path string, threadId string) (*pb.Block, error)
- func (t *Textile) AddSyncFile(file *pb.SyncFile) error
- func (t *Textile) AddThread(conf pb.AddThreadConfig, sk libp2pc.PrivKey, initiator string, join bool, ...) (*Thread, error)
- func (t *Textile) AddVideo(video *pb.Video) error
- func (t *Textile) AddVideoChunk(vchunk *pb.VideoChunk) error
- func (t *Textile) Avatar() string
- func (t *Textile) BigFileAtStream(feedpb *pb.FeedStreamMeta, cid []byte) (string, string, error)
- func (t *Textile) Block(id string) (*pb.Block, error)
- func (t *Textile) BlockByParent(parent string) (*pb.Block, error)
- func (t *Textile) BlockView(id string) (*pb.Block, error)
- func (t *Textile) Blocks(offset string, limit int, query string) *pb.BlockList
- func (t *Textile) BlocksByTarget(target string) *pb.BlockList
- func (t *Textile) CafeApiAddr() string
- func (t *Textile) CafeInfo() *pb.Cafe
- func (t *Textile) CafeRequestThreadsContent(cafe string) error
- func (t *Textile) CafeSession(id string) (*pb.CafeSession, error)
- func (t *Textile) CafeSessions() *pb.CafeSessionList
- func (t *Textile) CafeTokens() ([]string, error)
- func (t *Textile) CheckCafeMessages() error
- func (t *Textile) ChunksByVideoId(videoId string) *pb.VideoChunkList
- func (t *Textile) CloseChns()
- func (t *Textile) CloseStream(threadId string, streamId string) error
- func (t *Textile) Comment(blockId string) (*pb.Comment, error)
- func (t *Textile) Comments(target string) (*pb.CommentList, error)
- func (t *Textile) Config() *config.Config
- func (t *Textile) ConnectCafes()
- func (t *Textile) ConnectShadowTCP(ip string, port int) error
- func (t *Textile) ConnectThreadPeers(tid string) error
- func (t *Textile) ConnectedAddresses() (*pb.SwarmPeerList, error)
- func (t *Textile) Contact(address string) *pb.Contact
- func (t *Textile) ContactThreads(address string) (*pb.ThreadList, error)
- func (t *Textile) Contacts() *pb.ContactList
- func (t *Textile) CountUnreadNotifications() int
- func (t *Textile) CreateCafeToken(token string, store bool) (string, error)
- func (t *Textile) CreateTCPPool()
- func (t *Textile) DataAtPath(path string) ([]byte, error)
- func (t *Textile) DataAtStreamFile(feedpb *pb.FeedStreamMeta, cid []byte) ([]byte, string, error)
- func (t *Textile) Datastore() repo.Datastore
- func (t *Textile) Decrypt(input []byte) ([]byte, error)
- func (t *Textile) DeregisterCafe(id string) error
- func (t *Textile) DiscoverAndConnect()
- func (t *Textile) DiscoverContacts(options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
- func (t *Textile) DoneCh() <-chan struct{}
- func (t *Textile) Encrypt(input []byte) ([]byte, error)
- func (t *Textile) Feed(req *pb.FeedRequest) (*pb.FeedItemList, error)
- func (t *Textile) File(blockId string) (*pb.Files, error)
- func (t *Textile) FileAsStream_Text(threadId string, sf *pb.StreamFile, file_type pb.StreamMeta_Type) (*pb.StreamMeta, error)
- func (t *Textile) FileContent(hash string) (io.ReadSeeker, *pb.FileIndex, error)
- func (t *Textile) FileIndexContent(file *pb.FileIndex) (io.ReadSeeker, error)
- func (t *Textile) FileMeta(hash string) (*pb.FileIndex, error)
- func (t *Textile) FilePathAtPath(path string) (string, error)
- func (t *Textile) Files(offset string, limit int, threadId string) (*pb.FilesList, error)
- func (t *Textile) FlushBlocks()
- func (t *Textile) FlushCafes()
- func (t *Textile) FolderAtPath(path string) (string, error)
- func (t *Textile) GetDuration(streamId string) int64
- func (t *Textile) GetMaxWorkers() int
- func (t *Textile) GetMedia(reader io.Reader) (string, error)
- func (t *Textile) GetMillMedia(reader io.Reader, mill m.Mill) (string, error)
- func (t *Textile) GetRecord(key string) (string, error)
- func (t *Textile) GetStreamBlocks(streamId string, startIndex int) ([]cid.Cid, error)
- func (t *Textile) GetStreamMeta(id string) *pb.StreamMeta
- func (t *Textile) GetStreamMode() int
- func (t *Textile) GetSwarmAddress(peerId string) string
- func (t *Textile) GetVideo(id string) *pb.Video
- func (t *Textile) GetVideoChunk(videoId string, chunk string) *pb.VideoChunk
- func (t *Textile) GetVideoChunkByIndex(videoId string, index int64) *pb.VideoChunk
- func (t *Textile) IgnoreInvite(id string) error
- func (t *Textile) IgnoreInviteViaNotification(id string) error
- func (t *Textile) Inbox() *CafeInbox
- func (t *Textile) InviteView(invite *pb.Invite) *pb.InviteView
- func (t *Textile) Invites() *pb.InviteViewList
- func (t *Textile) Ipfs() *core.IpfsNode
- func (t *Textile) IsAdminByAddress(threadId string, peerAddr string) (bool, error)
- func (t *Textile) IsAdminById(threadId string, peerId string) (bool, error)
- func (t *Textile) IsStreamFinished(id string) bool
- func (t *Textile) Like(blockId string) (*pb.Like, error)
- func (t *Textile) Likes(target string) (*pb.LikeList, error)
- func (t *Textile) LinksAtPath(path string) ([]*ipld.Link, error)
- func (t *Textile) ListStreamMeta() *pb.StreamMetaList
- func (t *Textile) ListSyncFile(address string, fileType pb.SyncFile_Type) *pb.SyncFileList
- func (t *Textile) Message(blockId string) (*pb.Text, error)
- func (t *Textile) Messages(offset string, limit int, threadId string) (*pb.TextList, error)
- func (t *Textile) Mobile() bool
- func (t *Textile) MySwarmAddress() string
- func (t *Textile) Name() string
- func (t *Textile) NotificationCh() <-chan *pb.Notification
- func (t *Textile) NotificationView(note *pb.Notification) *pb.Notification
- func (t *Textile) Notifications(offset string, limit int) *pb.NotificationList
- func (t *Textile) OLD_PublishVideo(video *pb.Video, store bool) error
- func (t *Textile) OLD_PublishVideoChunk(vchunk *pb.VideoChunk) error
- func (t *Textile) Online() bool
- func (t *Textile) OnlineCh() <-chan struct{}
- func (t *Textile) PeerId() (peer.ID, error)
- func (t *Textile) PeerUser(id string) *pb.User
- func (t *Textile) Ping(pid peer.ID) (service.PeerStatus, error)
- func (t *Textile) Profile() *pb.Peer
- func (t *Textile) Publish(payload []byte, topic string) error
- func (t *Textile) PublishPeer() error
- func (t *Textile) PublishPeerToCafe(id string) error
- func (t *Textile) PublishSyncFile(file *pb.SyncFile) error
- func (t *Textile) PublishVideo(video string) error
- func (t *Textile) PublishVideoChunk(vchunk string) error
- func (t *Textile) ReSubscribeStream(id string) error
- func (t *Textile) ReadAllNotifications() error
- func (t *Textile) ReadNotification(id string) error
- func (t *Textile) RefreshCafeSession(id string) (*pb.CafeSession, error)
- func (t *Textile) RegisterCafe(id string, token string) (*pb.CafeSession, error)
- func (t *Textile) RemoveCafeToken(token string) error
- func (t *Textile) RemoveContact(address string) error
- func (t *Textile) RemoveRecordReport(key string) error
- func (t *Textile) RemoveThread(id string) (mh.Multihash, error)
- func (t *Textile) RemoveVideo(id string) error
- func (t *Textile) RenameThread(id string, name string) error
- func (t *Textile) RepoPath() string
- func (t *Textile) RequestStream(pid string, config *pb.StreamRequest) (*pb.Envelope, error)
- func (t *Textile) SearchContacts(query *pb.ContactQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
- func (t *Textile) SearchStream(query *pb.StreamQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
- func (t *Textile) SearchSyncFiles(query *pb.SyncFileQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
- func (t *Textile) SearchThreadSnapshots(query *pb.ThreadSnapshotQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
- func (t *Textile) SearchVideo(query *pb.VideoQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
- func (t *Textile) SearchVideoChunks(query *pb.VideoChunkQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
- func (t *Textile) SendRecordReport(key string, peerId string) error
- func (t *Textile) SendRecordReportPb(report *pb.RecordReport, peerId string) error
- func (t *Textile) Server() bool
- func (t *Textile) SetAvatar() error
- func (t *Textile) SetLogLevel(level *pb.LogLevel, color bool) error
- func (t *Textile) SetMaxWorkers(n int)
- func (t *Textile) SetName(name string) error
- func (t *Textile) SetServePeer(pubkey string) error
- func (t *Textile) SetStreamMode(mode int)
- func (t *Textile) Shadow() string
- func (t *Textile) ShadowIp() string
- func (t *Textile) ShadowSpeedSlow(intv int64)
- func (t *Textile) ShadowStat() *pb.ShadowStat
- func (t *Textile) Sign(input []byte) ([]byte, error)
- func (t *Textile) SimpleThreadView(id string) (*pb.Thread, error)
- func (t *Textile) SnapshotThreads() error
- func (t *Textile) Start() error
- func (t *Textile) StartRecord(key string) error
- func (t *Textile) StartRecordReport(key string) error
- func (t *Textile) StartStream(threadId string, config *pb.StreamMeta) error
- func (t *Textile) StartStream_Text(threadId string, config *pb.StreamMeta) error
- func (t *Textile) Started() bool
- func (t *Textile) Stop() error
- func (t *Textile) StopRecord(key string) error
- func (t *Textile) StopRecordReport(key string) error
- func (t *Textile) StreamAddFile(id string, sf *pb.StreamFile) error
- func (t *Textile) StreamGetParent(sid string) string
- func (t *Textile) StreamGetStatusString(sid string) string
- func (t *Textile) StreamRequestAccepted(pid string, config *pb.StreamRequest)
- func (t *Textile) StreamWorkerStat()
- func (t *Textile) SubscribeNotify(id string, res bool)
- func (t *Textile) SubscribeStream(id string) error
- func (t *Textile) Summary() *pb.Summary
- func (t *Textile) SyncAccount(options *pb.QueryOptions) (*broadcast.Broadcaster, error)
- func (t *Textile) SyncFile(file *pb.SyncFile) error
- func (t *Textile) TargetNodeKeys(node ipld.Node) (*pb.Keys, error)
- func (t *Textile) Thread(id string) *Thread
- func (t *Textile) ThreadAddAdmin(threadId string, peerId string) error
- func (t *Textile) ThreadAddStream(threadId string, streamId string) error
- func (t *Textile) ThreadAddVideo(threadId string, videoId string) error
- func (t *Textile) ThreadAdmins(id string) (*pb.PeerList, error)
- func (t *Textile) ThreadByKey(key string) *Thread
- func (t *Textile) ThreadByName(name string) *Thread
- func (t *Textile) ThreadNonAdmins(id string) (*pb.PeerList, error)
- func (t *Textile) ThreadPeers(id string) (*pb.PeerList, error)
- func (t *Textile) ThreadRemovePeer(threadId string, peerId string) error
- func (t *Textile) ThreadUpdateListener() *broadcast.Listener
- func (t *Textile) ThreadView(id string) (*pb.Thread, error)
- func (t *Textile) Threads() []*Thread
- func (t *Textile) TryConnect(peerId string)
- func (t *Textile) TryConnectPeers(query *pb.IpfsQuery) (bool, error)
- func (t *Textile) TryConnectShadowByRelay(shadowId string)
- func (t *Textile) TryConnectThroughRelay(ids []string) (bool, error)
- func (t *Textile) UnsubscribeStream(id string) error
- func (t *Textile) UpdateCh() <-chan *pb.AccountUpdate
- func (t *Textile) UpdatePeerInboxes() error
- func (t *Textile) ValidateCafeToken(token string) (bool, error)
- func (t *Textile) Verify(input []byte, sig []byte) error
- func (t *Textile) WaitAdd(delta int, src string)
- func (t *Textile) WaitDone(src string)
- func (t *Textile) WriteTreeCSV(streamId string, outPath string) error
- func (t *Textile) Writer() io.Writer
- type Thread
- func (t *Thread) AddAdmin(peerId string) (mh.Multihash, error)
- 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, target string, caption string, keys map[string]string) (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(p *pb.Peer) (mh.Multihash, error)
- func (t *Thread) AddLike(target string) (mh.Multihash, error)
- func (t *Thread) AddMessage(target string, body string) (mh.Multihash, error)
- func (t *Thread) AddPicture(node ipld.Node, target string, caption string, keys map[string]string) (mh.Multihash, error)
- func (t *Thread) AddSimpleFile(file *pb.SimpleFile) (*pb.Block, error)
- func (t *Thread) AddStreamMeta(stream *pb.StreamMeta) (mh.Multihash, error)
- func (t *Thread) AddStreamMeta_Text(stream *pb.StreamMeta) (mh.Multihash, error)
- func (t *Thread) AddVideo(video *pb.Video) (mh.Multihash, error)
- func (t *Thread) Admins() []pb.ThreadPeer
- func (t *Thread) Annouce(msg *pb.ThreadAnnounce) (mh.Multihash, error)
- func (t *Thread) Decrypt(data []byte) ([]byte, error)
- func (t *Thread) Encrypt(data []byte) ([]byte, error)
- func (t *Thread) Heads() ([]string, error)
- func (t *Thread) LatestFiles() *pb.Block
- func (t *Thread) NonAdmins() []pb.ThreadPeer
- func (t *Thread) Peers() []pb.ThreadPeer
- func (t *Thread) RemovePeer(peerId string) (mh.Multihash, error)
- func (t *Thread) UpdateSchema(hash string) error
- type ThreadConfig
- type ThreadsService
- func (h *ThreadsService) Handle(env *pb.Envelope, pid peer.ID) (*pb.Envelope, error)
- func (h *ThreadsService) HandleStream(env *pb.Envelope, pid peer.ID) (chan *pb.Envelope, chan error, chan interface{})
- func (h *ThreadsService) ListenOneThread(threadId string)
- func (h *ThreadsService) ListenThreads()
- func (h *ThreadsService) NewEnvelope(threadId string, node []byte, block []byte, sig []byte) (*pb.Envelope, error)
- func (h *ThreadsService) NewEnvelopeAck(sig []byte) (*pb.Envelope, error)
- func (h *ThreadsService) Ping(pid peer.ID) (service.PeerStatus, error)
- func (h *ThreadsService) Protocol() protocol.ID
- func (h *ThreadsService) SendMessage(ctx context.Context, peerId string, env *pb.Envelope) error
- func (h *ThreadsService) SendPubSubMessage(msg pb.BlockMessage) error
- func (h *ThreadsService) Start()
- type Variables
Constants ¶
const ( CAFEROLEMAP = 1 SHADOWROLEMAP = 2 )
const CafeApiVersion = "v1"
CafeApiVersion is the cafe api version
const ContentLinkName = "content"
const MAX_RETRY = 10
const MetaLinkName = "meta"
Variables ¶
var ErrAccountRequired = fmt.Errorf("account required")
common errors
var ErrBlockNotFound = fmt.Errorf("block not found")
ErrBlockNotFound indicates a block was not found in the index
var ErrBlockWrongType = fmt.Errorf("block type is not the type requested")
ErrBlockWrongType indicates a block was requested as a type other than its own
var ErrContactNotFound = fmt.Errorf("contact not found")
ErrContactNotFound indicates a local contact was not found
var ErrFileNotFound = fmt.Errorf("file not found")
var ErrInvalidFileNode = fmt.Errorf("invalid files node")
ErrInvalidFileNode indicates files where added via a nil ipld node
var ErrInvalidNode = fmt.Errorf("thread node is not valid")
ErrInvalidNode indicates the thread node is not valid
var ErrInvalidThreadBlock = fmt.Errorf("invalid thread block")
ErrInvalidThreadBlock is a catch all error for malformed / invalid blocks
var ErrJsonSchemaRequired = fmt.Errorf("thread schema does not allow json files")
ErrJsonSchemaRequired indicates json files where added without a json schema
var ErrMissingContentLink = fmt.Errorf("content link not in node")
var ErrMissingMetaLink = fmt.Errorf("meta link not in node")
var ErrMissingRepoConfig = fmt.Errorf("you must specify InitConfig.RepoPath or InitConfig.BaseRepoPath and InitConfig.Account")
var ErrNotAdmin = fmt.Errorf("not an admin of the thread")
ErrNotAdmin inicates non-admin try to do something that only admins can do
var ErrNotAnnotatable = fmt.Errorf("thread is not annotatable")
ErrNotAnnotatable indicates the thread is not annotatable (comments/likes)
var ErrNotReadable = fmt.Errorf("thread is not readable")
ErrNotReadable indicates the thread is not readable
ErrNotShareable indicates the thread does not allow invites, at least for _you_
var ErrNotWritable = fmt.Errorf("thread is not writable")
ErrNotWritable indicates the thread is not writable (files/messages)
var ErrOffline = fmt.Errorf("node is offline")
var ErrRemoveSelf = fmt.Errorf("do not use RemovePeer, try use thread.leave")
ErrRemoveSelf indecates an admin try to remove itself from a thread, try use leave
var ErrStarted = fmt.Errorf("node is started")
var ErrStopped = fmt.Errorf("node is stopped")
var ErrStreamAlreadyInUse = fmt.Errorf("stream already in use")
var ErrStreamNotFound = fmt.Errorf("stream not found")
var ErrSubscribeFail = fmt.Errorf("subscribe failed")
var ErrThreadInviteNotFound = fmt.Errorf("thread invite not found")
ErrThreadInviteNotFound indicates thread invite is not found
var ErrThreadLoaded = fmt.Errorf("thread is loaded")
ErrThreadLoaded indicates the thread is already loaded from the datastore
var ErrThreadNotFound = fmt.Errorf("thread not found")
ErrThreadNotFound indicates thread is not found in the loaded list
var ErrThreadSchemaRequired = fmt.Errorf("thread schema required to add files")
ErrThreadSchemaRequired indicates files where added without a thread schema
var ErrVideoNotFound = fmt.Errorf("video not found")
var ValidContentLinkNames = []string{"content", "d"}
var ValidMetaLinkNames = []string{"meta", "f"}
Functions ¶
func AccountRepoExists ¶
AccountRepoExists return whether or not the repo at repoPath exists
func ConvertHeadersToCorsOptions ¶
func ConvertHeadersToCorsOptions(headers config.HTTPHeaders) cors.Options
ConvertHeadersToCorsOptions converts http headers into the format that cors options accepts
func FeedItemType ¶
func FeedItemType(item *pb.FeedItem) (pb.Block_BlockType, error)
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
func RepoExists ¶
RepoExists return whether or not the repo at repoPath exists
Types ¶
type AddFileConfig ¶
type BlockDownloads ¶
type BlockDownloads struct {
// contains filtered or unexported fields
}
BlockDownloads manages a queue of pending downloads
func NewBlockDownloads ¶
func NewBlockDownloads(node func() *core.IpfsNode, datastore repo.Datastore, getThread func(id string) *Thread) *BlockDownloads
NewBlockDownloads creates a new download queue
type BlockOutbox ¶
type BlockOutbox struct {
// contains filtered or unexported fields
}
BlockOutbox queues and processes outbound thread messages
func NewBlockOutbox ¶
func NewBlockOutbox( service func() *ThreadsService, node func() *core.IpfsNode, datastore repo.Datastore, cafeOutbox *CafeOutbox) *BlockOutbox
NewBlockOutbox creates a new outbox queue
type CafeError ¶
type CafeError struct {
Error string `json:"error"`
}
CafeError represents a cafe request error
type CafeInbox ¶
type CafeInbox struct {
// contains filtered or unexported fields
}
CafeInbox queues and processes downloaded cafe 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( node func() *core.IpfsNode, datastore repo.Datastore, handler CafeOutboxHandler, flushBlocks func()) *CafeOutbox
NewCafeOutbox creates a new outbox queue
func (*CafeOutbox) Add ¶
func (q *CafeOutbox) Add(target string, rtype pb.CafeRequest_Type, opts ...CafeRequestOption) error
Add adds a request for each active cafe session
func (*CafeOutbox) AddForInbox ¶
AddForInbox adds a request for a peer's inbox(es)
func (*CafeOutbox) Flush ¶
func (q *CafeOutbox) Flush(skipBlocks bool)
Flush processes pending requests
type CafeOutboxHandler ¶
type CafeOutboxHandler interface {
Flush()
}
CafeOutboxHandler is fullfilled by the layer responsible for cafe network requests
Desktop and Server => CafeService over libp2p Mobile => Objc and Java SDKs
type CafeRequestOption ¶
type CafeRequestOption func(*CafeRequestSettings)
CafeRequestOption returns a request setting from an option
func (CafeRequestOption) Cafe ¶
func (CafeRequestOption) Cafe(val string) CafeRequestOption
Cafe limits the request to a single cafe
func (CafeRequestOption) Group ¶
func (CafeRequestOption) Group(val string) CafeRequestOption
Group sets the request's group field
func (CafeRequestOption) Size ¶
func (CafeRequestOption) Size(val int) CafeRequestOption
Size sets the request's size in bytes
func (CafeRequestOption) SyncGroup ¶
func (CafeRequestOption) SyncGroup(val string) CafeRequestOption
SyncGroup sets the request's sync group field
type CafeRequestSettings ¶
CafeRequestSettings for a request
func CafeRequestOptions ¶
func CafeRequestOptions(opts ...CafeRequestOption) *CafeRequestSettings
CafeRequestOptions returns request settings from options
func (*CafeRequestSettings) Options ¶
func (s *CafeRequestSettings) Options() []CafeRequestOption
Options converts settings back to options
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 func() *core.IpfsNode, datastore repo.Datastore, inbox *CafeInbox, stream *stream.StreamService, shadow *shadow.ShadowService) *CafeService
NewCafeService returns a new threads service
func (*CafeService) CafeFindIpfsAddr ¶
func (h *CafeService) CafeFindIpfsAddr(query *pb.IpfsQuery, cafeId string) (*pb.IpfsQueryResult, error)
func (*CafeService) CheckMessages ¶
func (h *CafeService) CheckMessages(cafeId string) error
CheckMessages asks each session's inbox for new messages
func (*CafeService) DeleteMessages ¶
func (h *CafeService) DeleteMessages(cafeId string) error
DeleteMessages deletes a page of messages from a cafe
func (*CafeService) Deregister ¶
func (h *CafeService) Deregister(cafeId string) error
Deregister removes this peer from a cafe
func (*CafeService) DiscoverPeers ¶
func (h *CafeService) DiscoverPeers(cafeId string) ([]string, error)
func (*CafeService) Flush ¶
func (h *CafeService) Flush()
Flush begins handling requests recursively
func (*CafeService) HandleStream ¶
func (h *CafeService) HandleStream(env *pb.Envelope, pid peer.ID) (chan *pb.Envelope, chan error, chan interface{})
HandleStream is called by the underlying service handler method
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) PublishPeer ¶
func (h *CafeService) PublishPeer(peer *pb.Peer, cafeId string) error
PublishPeer publishes the local peer's info
func (*CafeService) PublishSyncFile ¶
func (h *CafeService) PublishSyncFile(file *pb.SyncFile, cafeId string) error
func (*CafeService) PublishVideo ¶
func (*CafeService) PublishVideoChunk ¶
func (h *CafeService) PublishVideoChunk(vchunk *pb.VideoChunk, cafeId string) error
func (*CafeService) Register ¶
func (h *CafeService) Register(cafeId string, token string) (*pb.CafeSession, error)
Register creates a session with a cafe
func (*CafeService) Search ¶
func (h *CafeService) Search(query *pb.Query, cafeId string, reply func(*pb.QueryResult), cancelCh <-chan interface{}) error
Search performs a query via a cafe
type ErrStreamAlreadyExist ¶
type ErrStreamAlreadyExist struct {
// contains filtered or unexported fields
}
func (*ErrStreamAlreadyExist) Error ¶
func (e *ErrStreamAlreadyExist) Error() string
type ErrStreamNotExist ¶
type ErrStreamNotExist struct {
Id string
}
func (*ErrStreamNotExist) Error ¶
func (e *ErrStreamNotExist) Error() string
type FeedItemPayload ¶
type FeedItemPayload interface { GetUser() *pb.User GetDate() *timestamp.Timestamp Reset() String() string ProtoMessage() }
func GetFeedItemPayload ¶
func GetFeedItemPayload(item *pb.FeedItem) (FeedItemPayload, error)
type InitConfig ¶
type InitConfig struct { Account *keypair.Full PinCode string RepoPath string BaseRepoPath string SwarmPorts string ApiAddr string CafeApiAddr string GatewayAddr string ProfilingAddr string IsMobile bool IsServer bool LogToDisk bool Debug bool CafeOpen bool CafeURL string CafeNeighborURL string IsPrivate bool IsShadow bool // whether the node works as a shadow node, default:0, added in 2020.04.05 IsAuto bool // whether the node works as a automatic node. default:0, added in 2020.6.14 }
InitConfig is used to setup a textile node
func (InitConfig) Repo ¶
func (conf InitConfig) Repo() (string, error)
Repo returns the actual location of the configured repo
func (InitConfig) RepoExists ¶
func (conf InitConfig) RepoExists() (bool, error)
RepoExists return whether or not the configured repo already exists
type MigrateConfig ¶
MigrateConfig is used to define options during a major migration
type RunConfig ¶
type RunConfig struct { PinCode string RepoPath string CafeOutboxHandler CafeOutboxHandler CheckMessages func() error Debug bool }
RunConfig is used to define run options for a textile node
type Textile ¶
type Textile struct {
// contains filtered or unexported fields
}
Textile is the main Textile node structure
func CreateAndStartPeer ¶
func CreateAndStartPeer(conf InitConfig, wait bool) (*Textile, error)
func NewTextile ¶
NewTextile runs a node out of an initialized repo
func (*Textile) AcceptExternalInvite ¶
AcceptExternalInvite attemps to download an encrypted thread key from an external invite, adds a new thread, and notifies the inviter of the join
func (*Textile) AcceptInvite ¶
AcceptInvite adds a new thread, and notifies the inviter of the join
func (*Textile) AcceptInviteViaNotification ¶
AcceptInviteViaNotification uses an invite notification to accept an invite to a thread
func (*Textile) AccountContact ¶
AccountContact returns a contact for this account
func (*Textile) AccountProfile ¶
func (*Textile) AccountThread ¶
AccountThread returns the account private thread
func (*Textile) AddContact ¶
AddContact adds or updates a card
func (*Textile) AddExternalInvite ¶
func (t *Textile) AddExternalInvite(threadId string) (*pb.ExternalInvite, error)
AddExternalInvite generates a new external invite link to a thread
func (*Textile) AddFileIndex ¶
func (*Textile) AddNodeFromDirs ¶
func (*Textile) AddNodeFromFiles ¶
func (*Textile) AddOrUpdateThread ¶
AddOrUpdateThread add or updates a thread directly, usually from a backup
func (*Textile) AddSimpleDirectory ¶
func (*Textile) AddSimpleFile ¶
func (*Textile) AddSimplePicture ¶
func (*Textile) AddThread ¶
func (t *Textile) AddThread(conf pb.AddThreadConfig, sk libp2pc.PrivKey, initiator string, join bool, inviteAccount bool) (*Thread, error)
AddThread adds a thread with a given name and secret key
func (*Textile) AddVideoChunk ¶
func (t *Textile) AddVideoChunk(vchunk *pb.VideoChunk) error
func (*Textile) BigFileAtStream ¶
func (*Textile) BlockByParent ¶
Block returns block with id
func (*Textile) BlocksByTarget ¶
BlocksByTarget returns block with parent
func (*Textile) CafeApiAddr ¶
CafeApiAddr returns the cafe api address
func (*Textile) CafeRequestThreadsContent ¶
CafeRequestThreadContent sync the entire thread conents (blocks and files) to the given cafe
func (*Textile) CafeSession ¶
func (t *Textile) CafeSession(id string) (*pb.CafeSession, error)
CafeSession returns an active session by id
func (*Textile) CafeSessions ¶
func (t *Textile) CafeSessions() *pb.CafeSessionList
CafeSessions lists active cafe sessions
func (*Textile) CafeTokens ¶
CafeTokens lists all locally-stored (bcrypt hashed) tokens
func (*Textile) CheckCafeMessages ¶
CheckCafeMessages fetches new messages from registered cafes
func (*Textile) ChunksByVideoId ¶
func (t *Textile) ChunksByVideoId(videoId string) *pb.VideoChunkList
func (*Textile) CloseStream ¶
CloseStream close a stream already exist.
func (*Textile) ConnectCafes ¶
func (t *Textile) ConnectCafes()
func (*Textile) ConnectShadowTCP ¶
Connect to shadow peer through tcp command directly.
func (*Textile) ConnectThreadPeers ¶
func (*Textile) ConnectedAddresses ¶
func (t *Textile) ConnectedAddresses() (*pb.SwarmPeerList, error)
func (*Textile) ContactThreads ¶
func (t *Textile) ContactThreads(address string) (*pb.ThreadList, error)
ContactThreads returns all threads with the given address
func (*Textile) Contacts ¶
func (t *Textile) Contacts() *pb.ContactList
Contacts returns all known contacts, excluding self
func (*Textile) CountUnreadNotifications ¶
CountUnreadNotifications counts unread notifications
func (*Textile) CreateCafeToken ¶
CreateCafeToken creates (or uses `token`) random access token, returns base58 encoded version, and stores (unless `store` is false) a bcrypt hashed version for later comparison
func (*Textile) CreateTCPPool ¶
func (t *Textile) CreateTCPPool()
func (*Textile) DataAtPath ¶
DataAtPath returns raw data behind an ipfs path
func (*Textile) DataAtStreamFile ¶
Moved from mobile/ipfs.go So that desktop daemon can send notification back too.
func (*Textile) DeregisterCafe ¶
DeregisterCafe removes the session associated with the given cafe
func (*Textile) DiscoverAndConnect ¶
func (t *Textile) DiscoverAndConnect()
func (*Textile) DiscoverContacts ¶
func (t *Textile) DiscoverContacts(options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
func (*Textile) DoneCh ¶
func (t *Textile) DoneCh() <-chan struct{}
DoneCh returns the core node done channel
func (*Textile) Feed ¶
func (t *Textile) Feed(req *pb.FeedRequest) (*pb.FeedItemList, error)
func (*Textile) FileAsStream_Text ¶
func (t *Textile) FileAsStream_Text(threadId string, sf *pb.StreamFile, file_type pb.StreamMeta_Type) (*pb.StreamMeta, error)
func (*Textile) FileContent ¶
func (*Textile) FileIndexContent ¶
func (*Textile) FlushBlocks ¶
func (t *Textile) FlushBlocks()
FlushBlocks flushes the block message outbox
func (*Textile) FlushCafes ¶
func (t *Textile) FlushCafes()
FlushCafes flushes the cafe request outbox
func (*Textile) GetDuration ¶
func (*Textile) GetMaxWorkers ¶
func (*Textile) GetMillMedia ¶
func (*Textile) GetStreamBlocks ¶
func (*Textile) GetStreamMeta ¶
func (t *Textile) GetStreamMeta(id string) *pb.StreamMeta
GetStreamMeta return a streamMeta from datastore.
func (*Textile) GetStreamMode ¶
func (*Textile) GetSwarmAddress ¶
func (*Textile) GetVideoChunk ¶
func (t *Textile) GetVideoChunk(videoId string, chunk string) *pb.VideoChunk
func (*Textile) GetVideoChunkByIndex ¶
func (t *Textile) GetVideoChunkByIndex(videoId string, index int64) *pb.VideoChunk
func (*Textile) IgnoreInvite ¶
IgnoreInvite deletes the invite and removes the associated notification.
func (*Textile) IgnoreInviteViaNotification ¶
IgnoreInviteViaNotification uses an invite notification to ignore an invite to a thread
func (*Textile) InviteView ¶
func (t *Textile) InviteView(invite *pb.Invite) *pb.InviteView
InviteView gets a pending invite as a view object, which does not include the block payload
func (*Textile) Invites ¶
func (t *Textile) Invites() *pb.InviteViewList
Invites lists info on all pending invites
func (*Textile) IsAdminByAddress ¶
check if peer is admin by peer address
func (*Textile) IsAdminById ¶
check if peer is admin by peer id
func (*Textile) IsStreamFinished ¶
func (*Textile) LinksAtPath ¶
LinksAtPath returns ipld links behind an ipfs path
func (*Textile) ListStreamMeta ¶
func (t *Textile) ListStreamMeta() *pb.StreamMetaList
ListStreamMeta return a list of streamMetas from datastore.
func (*Textile) ListSyncFile ¶
func (t *Textile) ListSyncFile(address string, fileType pb.SyncFile_Type) *pb.SyncFileList
func (*Textile) MySwarmAddress ¶
MySwarmAddress returns my swarm address
func (*Textile) NotificationCh ¶
func (t *Textile) NotificationCh() <-chan *pb.Notification
NotificationsCh returns the notifications channel
func (*Textile) NotificationView ¶
func (t *Textile) NotificationView(note *pb.Notification) *pb.Notification
NotificationView returns a notification with expanded view info
func (*Textile) Notifications ¶
func (t *Textile) Notifications(offset string, limit int) *pb.NotificationList
Notifications lists notifications
func (*Textile) OLD_PublishVideo ¶
--------------- OLD METHOD ----------------------------
func (*Textile) OLD_PublishVideoChunk ¶
func (t *Textile) OLD_PublishVideoChunk(vchunk *pb.VideoChunk) error
--------------- OLD METHOD ----------------------------
func (*Textile) OnlineCh ¶
func (t *Textile) OnlineCh() <-chan struct{}
OnlineCh returns the online channel
func (*Textile) PeerUser ¶
PeerUser returns a user object with the most recently updated contact for the given id Note: If no underlying contact is found, this will return a blank object w/ a generic user name for display-only purposes.
func (*Textile) PublishPeer ¶
PublishPeer publishes this peer's info to the cafe network
func (*Textile) PublishPeerToCafe ¶
func (*Textile) PublishVideo ¶
--------------- NEW METHOD ----------------------------
func (*Textile) PublishVideoChunk ¶
--------------- NEW METHOD ----------------------------
func (*Textile) ReSubscribeStream ¶
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(id string) (*pb.CafeSession, error)
RefreshCafeSession attempts to refresh a token with a cafe
func (*Textile) RegisterCafe ¶
RegisterCafe registers this account with another peer (the "cafe"), which provides a session token for the service
func (*Textile) RemoveCafeToken ¶
RemoveCafeToken removes a given cafe token from the local store
func (*Textile) RemoveContact ¶
RemoveContact removes all contacts that share the given address @todo Add ignore to account thread targeted at the join
func (*Textile) RemoveRecordReport ¶
func (*Textile) RemoveThread ¶
RemoveThread removes a thread @todo rename to abandon to be consistent with CLI+API
func (*Textile) RemoveVideo ¶
func (*Textile) RenameThread ¶
RenameThread adds an announce block to the thread w/ a new name Note: Only thread initiators can update the thread's name
func (*Textile) RequestStream ¶
RequestStream request a stream from a provider by sending stream request.
func (*Textile) SearchContacts ¶
func (t *Textile) SearchContacts(query *pb.ContactQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
SearchContacts searches the network for peers and returns contacts
func (*Textile) SearchStream ¶
func (t *Textile) SearchStream(query *pb.StreamQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
SearchStream search a stream by pubsub in network.
func (*Textile) SearchSyncFiles ¶
func (t *Textile) SearchSyncFiles(query *pb.SyncFileQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
SearchVideo searches the network for a video
func (*Textile) SearchThreadSnapshots ¶
func (t *Textile) SearchThreadSnapshots(query *pb.ThreadSnapshotQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
SearchThreadSnapshots searches the network for snapshots
func (*Textile) SearchVideo ¶
func (t *Textile) SearchVideo(query *pb.VideoQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
SearchVideo searches the network for a video
func (*Textile) SearchVideoChunks ¶
func (t *Textile) SearchVideoChunks(query *pb.VideoChunkQuery, options *pb.QueryOptions) (<-chan *pb.QueryResult, <-chan error, *broadcast.Broadcaster, error)
SearchVideoChunks searches the network for videoChunks
func (*Textile) SendRecordReport ¶
func (*Textile) SendRecordReportPb ¶
func (t *Textile) SendRecordReportPb(report *pb.RecordReport, peerId string) error
func (*Textile) SetLogLevel ¶
SetLogLevel provides node scoped access to the logging system
func (*Textile) SetMaxWorkers ¶
func (*Textile) SetServePeer ¶
func (*Textile) SetStreamMode ¶
func (*Textile) ShadowSpeedSlow ¶
func (*Textile) ShadowStat ¶
func (t *Textile) ShadowStat() *pb.ShadowStat
func (*Textile) SimpleThreadView ¶
func (*Textile) SnapshotThreads ¶
SnapshotThreads creates a store thread request for all threads
func (*Textile) StartRecord ¶
func (*Textile) StartRecordReport ¶
func (*Textile) StartStream ¶
func (t *Textile) StartStream(threadId string, config *pb.StreamMeta) error
StartStream does two tasks:
- Add stream to datastore.
- Start stream routine.
TODO:
Support renewal for existing stream.
func (*Textile) StartStream_Text ¶
func (t *Textile) StartStream_Text(threadId string, config *pb.StreamMeta) error
func (*Textile) StopRecord ¶
func (*Textile) StopRecordReport ¶
func (*Textile) StreamAddFile ¶
func (t *Textile) StreamAddFile(id string, sf *pb.StreamFile) error
StreamAddFile add the new file to the corresponding channel.
func (*Textile) StreamGetParent ¶
func (*Textile) StreamGetStatusString ¶
func (*Textile) StreamRequestAccepted ¶
func (t *Textile) StreamRequestAccepted(pid string, config *pb.StreamRequest)
func (*Textile) StreamWorkerStat ¶
func (t *Textile) StreamWorkerStat()
func (*Textile) SubscribeNotify ¶
SubscribeNotify print the log of subscribing a stream success or not, do not support substream currently.
func (*Textile) SubscribeStream ¶
SubscribeStream calls SearchStream and handleProviderSearchResult to subscribe a stream, and shadow node will also subscribe the same stream.
func (*Textile) SyncAccount ¶
func (t *Textile) SyncAccount(options *pb.QueryOptions) (*broadcast.Broadcaster, error)
SyncAccount performs a thread backup search and applies the result
func (*Textile) ThreadAddAdmin ¶
func (*Textile) ThreadAddStream ¶
ThreadAddStream add a stream to a thread.
func (*Textile) ThreadAddVideo ¶
func (*Textile) ThreadAdmins ¶
ThreadAdmins returns a list of thread admins
func (*Textile) ThreadByKey ¶
ThreadByKey get a thread by key from loaded threads
func (*Textile) ThreadByName ¶
ThreadByName get a thread by name from loaded threads WILL BE REMOVED!!!!
func (*Textile) ThreadNonAdmins ¶
ThreadAdmins returns a list of thread admins
func (*Textile) ThreadPeers ¶
ThreadPeers returns a list of thread peers
func (*Textile) ThreadRemovePeer ¶
func (*Textile) ThreadUpdateListener ¶
ThreadUpdateListener returns the thread update channel
func (*Textile) ThreadView ¶
ThreadView returns a thread with expanded view properties
func (*Textile) TryConnect ¶
func (*Textile) TryConnectPeers ¶
func (*Textile) TryConnectShadowByRelay ¶
func (*Textile) TryConnectThroughRelay ¶
func (*Textile) UnsubscribeStream ¶
UnsubscribeStream cancel subscribe to a stream.
func (*Textile) UpdateCh ¶
func (t *Textile) UpdateCh() <-chan *pb.AccountUpdate
UpdateCh returns the account update channel
func (*Textile) UpdatePeerInboxes ¶
UpdatePeerInboxes sets own peer inboxes from the current cafe sessions
func (*Textile) ValidateCafeToken ¶
ValidateCafeToken checks whether a supplied base58 encoded token matches the locally-stored bcrypt hashed equivalent
func (*Textile) WriteTreeCSV ¶
type Thread ¶
type Thread struct { Id string Key string // app key, usually UUID Name string PrivKey libp2pc.PrivKey Schema *pb.Node // contains filtered or unexported fields }
Thread is the primary mechanism representing a collecion of data / files / photos
func NewThread ¶
func NewThread(model *pb.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 add block, which can be retrieved by any peer and does not become part of the hash chain
func (*Thread) AddFiles ¶
func (t *Thread) AddFiles(node ipld.Node, target string, caption string, keys map[string]string) (mh.Multihash, error)
AddFile adds an outgoing files block
func (*Thread) AddIgnore ¶
AddIgnore adds an outgoing ignore block targeted at another block to ignore
func (*Thread) AddInvite ¶
AddInvite creates an outgoing add 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) AddPicture ¶
func (t *Thread) AddPicture(node ipld.Node, target string, caption string, keys map[string]string) (mh.Multihash, error)
AddPicture add a picture
func (*Thread) AddSimpleFile ¶
func (*Thread) AddStreamMeta ¶
func (*Thread) AddStreamMeta_Text ¶
func (*Thread) Admins ¶
func (t *Thread) Admins() []pb.ThreadPeer
Admins returns locally known admins in this thread
func (*Thread) LatestFiles ¶
LatestFiles returns the most recent files block
func (*Thread) NonAdmins ¶
func (t *Thread) NonAdmins() []pb.ThreadPeer
NonAdmins returns locally known none-admins in this thread
func (*Thread) Peers ¶
func (t *Thread) Peers() []pb.ThreadPeer
Peers returns locally known peers in this thread
func (*Thread) UpdateSchema ¶
UpdateSchema sets a new schema hash on the model and loads its node
type ThreadConfig ¶
type ThreadConfig struct { RepoPath string Config *config.Config Account *keypair.Full Node func() *core.IpfsNode Datastore repo.Datastore Service func() *ThreadsService BlockOutbox *BlockOutbox BlockDownloads *BlockDownloads CafeOutbox *CafeOutbox AddPeer func(*pb.Peer) error PushUpdate func(*pb.Block, string) }
ThreadConfig is used to construct a Thread
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 NewThreadsService ¶
func NewThreadsService( account *keypair.Full, node func() *core.IpfsNode, datastore repo.Datastore, getThread func(string) *Thread, addThread func([]byte, []string) (mh.Multihash, error), removeThread func(string) (mh.Multihash, error), sendNotification func(*pb.Notification) error, ) *ThreadsService
NewThreadsService returns a new threads service
func (*ThreadsService) HandleStream ¶
func (h *ThreadsService) HandleStream(env *pb.Envelope, pid peer.ID) (chan *pb.Envelope, chan error, chan interface{})
HandleStream is called by the underlying service handler method
func (*ThreadsService) ListenOneThread ¶
func (h *ThreadsService) ListenOneThread(threadId string)
func (*ThreadsService) ListenThreads ¶
func (h *ThreadsService) ListenThreads()
Subscribe topic for each thread
func (*ThreadsService) NewEnvelope ¶
func (h *ThreadsService) NewEnvelope(threadId string, node []byte, block []byte, sig []byte) (*pb.Envelope, error)
NewEnvelope signs and wraps an encypted block for transport
func (*ThreadsService) NewEnvelopeAck ¶
func (h *ThreadsService) NewEnvelopeAck(sig []byte) (*pb.Envelope, error)
NewEnvelopeAck signs and wraps an ack message
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 ¶
SendMessage sends a message to a peer
func (*ThreadsService) SendPubSubMessage ¶
func (h *ThreadsService) SendPubSubMessage(msg pb.BlockMessage) error
SendPubSubMessage publishes the message to the recipient's peerID-based topic and waits for an acknowledgement response. This mechanism can result in inbox-free direct messaging via a relay node, which can be useful when two peers are not direcly connected.
Source Files
¶
- account.go
- block_downloads.go
- block_outbox.go
- blocks.go
- cafe_api.go
- cafe_api_v0.go
- cafe_api_v1.go
- cafe_inbox.go
- cafe_outbox.go
- cafe_service.go
- cafes.go
- config.go
- contacts.go
- core.go
- feed.go
- feed_admin.go
- feed_announces.go
- feed_comments.go
- feed_files.go
- feed_flags.go
- feed_ignore.go
- feed_joins.go
- feed_leaves.go
- feed_likes.go
- feed_merges.go
- feed_messages.go
- feed_removepeer.go
- feed_simple_file.go
- feed_stream.go
- feed_video.go
- files.go
- invites.go
- ipfs.go
- notifications.go
- peers.go
- profile.go
- record.go
- search.go
- shadow.go
- simple_file.go
- stream.go
- summary.go
- sync_files.go
- test_utils.go
- thread.go
- thread_adds.go
- thread_admin.go
- thread_announces.go
- thread_comments.go
- thread_files.go
- thread_flags.go
- thread_ignores.go
- thread_joins.go
- thread_leaves.go
- thread_likes.go
- thread_merges.go
- thread_messages.go
- thread_removes.go
- thread_simple_file.go
- thread_stream_meta.go
- thread_video.go
- threads.go
- threads_service.go
- tokens.go
- videos.go