Documentation ¶
Index ¶
- Constants
- Variables
- func NewError(code int, s string) error
- func NewErrorf(code int, format string, args ...interface{}) error
- type API
- type CacheEntry
- type DefaultTimestampProvider
- type Error
- type Feed
- type Handler
- type ID
- type Query
- type Request
- type Signature
- type Timestamp
- type Topic
- type Update
Constants ¶
const ( ErrInit = iota ErrNotFound ErrIO ErrInvalidValue ErrDataOverflow ErrNothingToReturn ErrCorruptData ErrInvalidSignature ErrNotSynced ErrPeriodDepth ErrCnt )
const TopicLength = 32
TopicLength establishes the max length of a topic string
Variables ¶
var ( // ErrInvalidTopicSize is returned when a topic is not equal to TopicLength ErrInvalidTopicSize = fmt.Errorf("Topic is not equal to %d", TopicLength) // ErrInvalidPayloadSize is returned when the payload is greater than the chunk size ErrInvalidPayloadSize = fmt.Errorf("payload is greater than %d", utils.MaxChunkLength) )
var TimestampProvider timestampProvider = NewDefaultTimestampProvider()
TimestampProvider sets the time source of the feeds package
Functions ¶
Types ¶
type API ¶
type API struct {
// contains filtered or unexported fields
}
func New ¶
func New(accountInfo *account.AccountInfo, client blockstore.Client, logger logging.Logger) *API
func (*API) CreateFeed ¶
create feed
func (*API) GetFeedData ¶
type CacheEntry ¶
CacheEntry caches the last known update of a specific Swarm feed.
type DefaultTimestampProvider ¶
type DefaultTimestampProvider struct { }
DefaultTimestampProvider is a TimestampProvider that uses system time as time source
func NewDefaultTimestampProvider ¶
func NewDefaultTimestampProvider() *DefaultTimestampProvider
NewDefaultTimestampProvider creates a system clock based timestamp provider
func (*DefaultTimestampProvider) Now ¶
func (dtp *DefaultTimestampProvider) Now() Timestamp
Now returns the current time according to this provider
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error is a the typed error object used for Swarm feeds
type Handler ¶
type Handler struct { HashSize int // contains filtered or unexported fields }
func NewHandler ¶
func NewHandler(accountInfo *account.AccountInfo, client blockstore.Client, hasherPool *bmtlegacy.TreePool) *Handler
func (*Handler) GetContent ¶
GetContent retrieves the data payload of the last synced update of the feed
func (*Handler) Lookup ¶
Lookup retrieves a specific or latest feed update Lookup works differently depending on the configuration of `query` See the `query` documentation and helper functions: `NewQueryLatest` and `NewQuery`
func (*Handler) NewRequest ¶
NewRequest prepares a Request structure with all the necessary information to just add the desired data and sign it. The resulting structure can then be signed and passed to Handler.Update to be verified and sent
type Query ¶
Query is used to specify constraints when performing an update lookup TimeLimit indicates an upper bound for the search. Set to 0 for "now"
type Signature ¶
type Signature [signatureLength]byte
Signature is an alias for a assets byte array with the size of a signature
type Timestamp ¶
type Timestamp struct {
Time uint64 `json:"time"` // Unix epoch timestamp, in seconds
}
Timestamp encodes a point in time as a Unix epoch
func (*Timestamp) MarshalJSON ¶
MarshalJSON implements the json.Marshaller interface
func (*Timestamp) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaller interface