Documentation
¶
Index ¶
- Constants
- Variables
- func CreatePointerKey(mh multihash.Multihash, prefixLen int) multihash.Multihash
- func DoInit(repoRoot string, version string, mnemonic *string, initDB func(string) error, ...) (string, error)
- func FindPointers(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, ...) ([]ps.PeerInfo, error)
- func FindPointersAsync(dht *routing.IpfsDHT, ctx context.Context, mhKey multihash.Multihash, ...) <-chan ps.PeerInfo
- func GetPointersFromPeer(node *core.IpfsNode, ctx context.Context, p peer.ID, key *cid.Cid) ([]*ps.PeerInfo, error)
- func PublishPointer(node *core.IpfsNode, ctx context.Context, pointer Pointer) error
- func PutPointerToPeer(node *core.IpfsNode, ctx context.Context, peer peer.ID, pointer Pointer) error
- type Block
- type BlockStore
- type BlockType
- type CafeTokens
- type ConfigStore
- type DataBlockConfig
- type Datastore
- type Device
- type DeviceStore
- type Migration
- type Notification
- type NotificationStore
- type NotificationType
- type OfflineMessageStore
- type Peer
- type PeerStore
- type PinRequest
- type PinRequestStore
- type Pointer
- type PointerStore
- type ProfileStore
- type Purpose
- type Queryable
- type Thread
- type ThreadStore
Constants ¶
View Source
const MAGIC string = "000000000000000000000000"
Variables ¶
View Source
var ErrRepoExists = errors.New("repo not empty, reinitializing would overwrite your keys")
Functions ¶
func CreatePointerKey ¶
func CreatePointerKey(mh multihash.Multihash, prefixLen int) multihash.Multihash
func FindPointers ¶
func FindPointersAsync ¶
func GetPointersFromPeer ¶
func PublishPointer ¶
Types ¶
type Block ¶
type Block struct { Id string `json:"id"` Date time.Time `json:"date"` Parents []string `json:"parents"` ThreadId string `json:"thread_id"` AuthorPk string `json:"author_pk"` AuthorUsernameCipher []byte `json:"author_username_cipher"` Type BlockType `json:"type"` DataId string `json:"data_id"` DataKeyCipher []byte `json:"data_key_cipher"` DataCaptionCipher []byte `json:"data_caption_cipher"` DataMetadataCipher []byte `json:"data_metadata_cipher"` }
type BlockStore ¶
type CafeTokens ¶
type ConfigStore ¶
type DataBlockConfig ¶
type Datastore ¶
type Datastore interface { Config() ConfigStore Profile() ProfileStore Threads() ThreadStore Devices() DeviceStore Peers() PeerStore Blocks() BlockStore Notifications() NotificationStore OfflineMessages() OfflineMessageStore Pointers() PointerStore PinRequests() PinRequestStore Ping() error Close() }
type DeviceStore ¶
type Notification ¶
type Notification struct { Id string `json:"id"` Date time.Time `json:"date"` ActorId string `json:"actor_id"` // peer id ActorUsername string `json:"actor_username,omitempty"` // peer username Subject string `json:"subject"` // thread name | device name SubjectId string `json:"subject_id"` // thread id | device id BlockId string `json:"block_id,omitempty"` // block id DataId string `json:"data_id,omitempty"` // photo id, etc. Type NotificationType `json:"type"` Body string `json:"body"` Read bool `json:"read"` }
type NotificationStore ¶
type NotificationStore interface { Queryable Add(notification *Notification) error Get(id string) *Notification Read(id string) error ReadAll() error List(offset string, limit int, query string) []Notification CountUnread() int Delete(id string) error DeleteByActorId(actorId string) error DeleteBySubjectId(subjectId string) error DeleteByBlockId(blockId string) error }
type NotificationType ¶
type NotificationType int
const ( ReceivedInviteNotification NotificationType = iota // peerA invited you DeviceAddedNotification // new device added PhotoAddedNotification // peerA added a photo CommentAddedNotification // peerA commented on peerB's photo, video, comment, etc. LikeAddedNotification // peerA liked peerB's photo, video, comment, etc. PeerJoinedNotification // peerA joined PeerLeftNotification // peerA left TextAddedNotification // peerA added a message )
func (NotificationType) Description ¶
func (n NotificationType) Description() string
type OfflineMessageStore ¶
type PinRequest ¶
type PinRequestStore ¶
type PinRequestStore interface { Queryable Put(pr *PinRequest) error List(offset string, limit int) []PinRequest Delete(id string) error }
type Pointer ¶
type Pointer struct { Cid *cid.Cid Value ps.PeerInfo Purpose Purpose Date time.Time CancelId *peer.ID }
A pointer is a custom provider inserted into the DHT which points to a location of a file.
For offline messaging purposes we use a hash of the recipient's ID as the key and set the provider to the location of the ciphertext. We set the Peer ID of the provider object to a magic number so we distinguish it from regular providers and use a longer ttl. Note this will only be compatible with the OpenBazaar/go-ipfs fork.
type PointerStore ¶
type ProfileStore ¶
type ProfileStore interface { SignIn(username string, tokens *CafeTokens) error SignOut() error GetUsername() (*string, error) SetAvatarId(id string) error GetAvatarId() (*string, error) GetTokens() (tokens *CafeTokens, err error) UpdateTokens(tokens *CafeTokens) error }
Click to show internal directories.
Click to hide internal directories.