Documentation ¶
Overview ¶
go-ssb document
go-ssb project go-ssb.go
Index ¶
- Variables
- func Encode(i interface{}) ([]byte, error)
- func RegisterInit(f func(ds *DataStore))
- func RemoveUnsupported(e *encoding.Encoder) *encoding.Encoder
- func ToJSBinary(src []byte) []byte
- type DataStore
- func (ds *DataStore) Close()
- func (ds *DataStore) DB() *bolt.DB
- func (ds *DataStore) ExtraData(name string) interface{}
- func (ds *DataStore) Get(tx *bolt.Tx, post Ref) (m *SignedMessage)
- func (ds *DataStore) GetFeed(feedID Ref) *Feed
- func (ds *DataStore) LatestCountFiltered(num int, start int, filter map[Ref]int) (msgs []*SignedMessage)
- func (ds *DataStore) Rebuild(module string)
- func (ds *DataStore) RebuildAll()
- func (ds *DataStore) RegisterMethod(name string, method interface{})
- func (ds *DataStore) SetExtraData(name string, data interface{})
- type Feed
- func (f *Feed) AddMessage(m *SignedMessage) error
- func (f *Feed) Follow(seq int, live bool, handler func(m *SignedMessage) error, done chan struct{}) error
- func (f *Feed) GetSeq(tx *bolt.Tx, seq int) (m *SignedMessage)
- func (f *Feed) Latest() (m *SignedMessage)
- func (f *Feed) LatestCount(num int, start int) (msgs []*SignedMessage)
- func (f *Feed) Log(seq int, live bool) chan *SignedMessage
- func (f *Feed) PublishMessage(body interface{}) error
- type Message
- type MessageBody
- type MessageTopic
- type Pointer
- type Ref
- type RefAlgo
- type RefType
- type SigAlgo
- type Signature
- type SignedMessage
- type Signer
- type SignerEd25519
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrInvalidRefType = errors.New("Invalid Ref Type") ErrInvalidRefAlgo = errors.New("Invalid Ref Algo") ErrInvalidSig = errors.New("Invalid Signature") ErrInvalidHash = errors.New("Invalid Hash") )
View Source
var AddMessageHooks = map[string]func(m *SignedMessage, tx *bolt.Tx) error{}
View Source
var Compression1 = []byte(`{
"previous": ",
"author": ",
"sequence": ,
"timestamp": ,
"hash": "sha256",
"content": {
"type": "about"contact"post"vote",
"text": ",
"channel": ",
"root": ",
"branch": ",
"recps": ",
"mentions": [],
"about": ",
"name": ",
"image": ",
"contact": ",
"following": true,
"blocking": false,
"vote": {
"link": ",
"value": 1,
"reason": "Dug"
}
"repo": ",
}
"signature: ",
}`)
View Source
var Compression2 = []byte(`{
"previous": ",
"author": ",
"sequence": ,
"timestamp": ,
"hash": "sha256",
"content": {
"type": "about"contact"post"vote",
"text": ",
"channel": ",
"root": ",
"branch": ",
"recps": ",
"mentions": [],
"about": ",
"name": ",
"image": ",
"contact": ",
"following": true,
"blocking": false,
"vote": {
"link": ",
"value": 1,
"reason": "Dug"
}
"repo": "
}
"signature: "
}`)
View Source
var ErrLogClosed = errors.New("LogClosed")
View Source
var MessageTypes = map[string]func(mb MessageBody) interface{}{}
View Source
var RebuildClearHooks = map[string]func(tx *bolt.Tx) error{}
Functions ¶
func RegisterInit ¶
func RegisterInit(f func(ds *DataStore))
func ToJSBinary ¶
Types ¶
type DataStore ¶
type DataStore struct { Topic *MessageTopic PrimaryKey *secrethandshake.EdKeyPair PrimaryRef Ref Keys map[Ref]Signer // contains filtered or unexported fields }
func OpenDataStore ¶
func OpenDataStore(path string, primaryKey *secrethandshake.EdKeyPair) (*DataStore, error)
func (*DataStore) LatestCountFiltered ¶
func (*DataStore) RebuildAll ¶
func (ds *DataStore) RebuildAll()
func (*DataStore) RegisterMethod ¶
func (*DataStore) SetExtraData ¶
type Feed ¶
type Feed struct { ID Ref Topic *MessageTopic LatestSeq int SeqLock sync.Mutex // contains filtered or unexported fields }
func (*Feed) AddMessage ¶
func (f *Feed) AddMessage(m *SignedMessage) error
func (*Feed) Latest ¶
func (f *Feed) Latest() (m *SignedMessage)
func (*Feed) LatestCount ¶
func (f *Feed) LatestCount(num int, start int) (msgs []*SignedMessage)
func (*Feed) PublishMessage ¶
type Message ¶
type Message struct { Previous *Ref `json:"previous"` Author Ref `json:"author"` Sequence int `json:"sequence"` Timestamp float64 `json:"timestamp"` Hash string `json:"hash"` Content json.RawMessage `json:"content"` }
func (*Message) DecodeMessage ¶
func (*Message) Sign ¶
func (m *Message) Sign(s Signer) *SignedMessage
type MessageBody ¶
type MessageTopic ¶
type MessageTopic struct { Send chan *SignedMessage // contains filtered or unexported fields }
func NewMessageTopic ¶
func NewMessageTopic() *MessageTopic
func (*MessageTopic) Close ¶
func (mt *MessageTopic) Close()
func (*MessageTopic) Register ¶
func (mt *MessageTopic) Register(recp chan *SignedMessage, strict bool) chan *SignedMessage
func (*MessageTopic) Unregister ¶
func (mt *MessageTopic) Unregister(recp chan *SignedMessage)
type SignedMessage ¶
func DecompressMessage ¶
func DecompressMessage(cbuf []byte) *SignedMessage
func (*SignedMessage) Compress ¶
func (m *SignedMessage) Compress() []byte
func (*SignedMessage) Encode ¶
func (m *SignedMessage) Encode() []byte
func (*SignedMessage) Key ¶
func (m *SignedMessage) Key() Ref
type SignerEd25519 ¶
type SignerEd25519 struct {
Private ed25519.PrivateKey
}
func (SignerEd25519) Sign ¶
func (k SignerEd25519) Sign(content []byte) Signature
Source Files ¶
Click to show internal directories.
Click to hide internal directories.