repo

package
v0.0.0-...-0b7cff5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2017 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type About

type About struct {
	Pseudo      string
	Image       string
	ETHAddress  string
	Description string
}

func Import

func Import(b []byte) (About, error)

func (*About) Export

func (a *About) Export() ([]byte, error)

type Ledger

type Ledger struct {
	Repo string
	// contains filtered or unexported fields
}

func NewLedger

func NewLedger(repo_path string, ipfs_api string) *Ledger

func (*Ledger) About

func (l *Ledger) About(peer_name string) (string, error)

Just retrieve about.json

func (*Ledger) AddRessource

func (l *Ledger) AddRessource(b64 string) (string, error)

func (*Ledger) GetFeed

func (l *Ledger) GetFeed(peer_name string) ([]string, error)

Get all messages from a peer, return a slice of them, ordered from the more recent to the oldest

func (*Ledger) GetLastSeq

func (l *Ledger) GetLastSeq(peer_name string) (string, error)

Get the last seq number, as a string (no need to convert)

func (*Ledger) GetMessage

func (l *Ledger) GetMessage(peer_name string, sequence string) (string, error)

Get a message, returned as a reader

func (*Ledger) GetRessource

func (l *Ledger) GetRessource(id string) (string, error)

func (*Ledger) Publish

func (l *Ledger) Publish(data string) error

Add a message and increase the lastseq

func (*Ledger) Resolve

func (l *Ledger) Resolve(name string) (string, error)

func (*Ledger) SetAbout

func (l *Ledger) SetAbout(about About) error

Fill the profile of our user

func (*Ledger) Sync

func (l *Ledger) Sync() error

Recursively add stuff in the repo and do an `ipfs name publish`

func (*Ledger) Whoami

func (l *Ledger) Whoami() string

Return our id or ""

type LedgerInterface

type LedgerInterface interface {
	Sync() error
	GetMessage(peer_name string, sequence string) (string, error)
	GetLastSeq(peer_name string) (string, error)
	GetFeed(peer_name string) ([]string, error)
	Whoami() string
	About(peer_name string) (string, error)
	SetAbout(about About) error
	Publish(data string) error
	AddRessource(b64 string) (string, error)
	GetRessource(id string) (string, error)
	Resolve(name string) (string, error)
}

type Message

type Message struct {
	Seq       int
	Timestamp time.Time

	Data string
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL