mru

package
v0.0.0-...-b78b3a4 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2019 License: GPL-3.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrInit = iota
	ErrNotFound
	ErrIO
	ErrUnauthorized
	ErrInvalidValue
	ErrDataOverflow
	ErrNothingToReturn
	ErrCorruptData
	ErrInvalidSignature
	ErrNotSynced
	ErrPeriodDepth
	ErrCnt
)

Variables

View Source
var TimestampProvider timestampProvider = NewDefaultTimestampProvider()

Functions

func NewError

func NewError(code int, s string) error

func NewErrorf

func NewErrorf(code int, format string, args ...interface{}) error

Types

type DefaultTimestampProvider

type DefaultTimestampProvider struct {
}

func NewDefaultTimestampProvider

func NewDefaultTimestampProvider() *DefaultTimestampProvider

func (*DefaultTimestampProvider) Now

type Error

type Error struct {
	// contains filtered or unexported fields
}

func (*Error) Code

func (e *Error) Code() int

func (*Error) Error

func (e *Error) Error() string

type GenericSigner

type GenericSigner struct {
	PrivKey *ecdsa.PrivateKey
	// contains filtered or unexported fields
}

func NewGenericSigner

func NewGenericSigner(privKey *ecdsa.PrivateKey) *GenericSigner

func (*GenericSigner) Address

func (s *GenericSigner) Address() common.Address

func (*GenericSigner) Sign

func (s *GenericSigner) Sign(data common.Hash) (signature Signature, err error)

type Handler

type Handler struct {
	HashSize int
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(params *HandlerParams) *Handler

func (*Handler) GetContent

func (h *Handler) GetContent(rootAddr storage.Address) (storage.Address, []byte, error)

func (*Handler) GetLastPeriod

func (h *Handler) GetLastPeriod(rootAddr storage.Address) (uint32, error)

func (*Handler) GetVersion

func (h *Handler) GetVersion(rootAddr storage.Address) (uint32, error)

func (*Handler) Load

func (h *Handler) Load(ctx context.Context, rootAddr storage.Address) (*resource, error)

func (*Handler) Lookup

func (h *Handler) Lookup(ctx context.Context, params *LookupParams) (*resource, error)

func (*Handler) LookupPrevious

func (h *Handler) LookupPrevious(ctx context.Context, params *LookupParams) (*resource, error)

func (*Handler) New

func (h *Handler) New(ctx context.Context, request *Request) error

func (*Handler) NewUpdateRequest

func (h *Handler) NewUpdateRequest(ctx context.Context, rootAddr storage.Address) (updateRequest *Request, err error)

func (*Handler) SetStore

func (h *Handler) SetStore(store *storage.NetStore)

func (*Handler) Update

func (*Handler) Validate

func (h *Handler) Validate(chunkAddr storage.Address, data []byte) bool

type HandlerParams

type HandlerParams struct {
	QueryMaxPeriods uint32
}

type LookupParams

type LookupParams struct {
	UpdateLookup
	Limit uint32
}

func LookupLatest

func LookupLatest(rootAddr storage.Address) *LookupParams

func LookupLatestVersionInPeriod

func LookupLatestVersionInPeriod(rootAddr storage.Address, period uint32) *LookupParams

func LookupVersion

func LookupVersion(rootAddr storage.Address, period, version uint32) *LookupParams

func NewLookupParams

func NewLookupParams(rootAddr storage.Address, period, version uint32, limit uint32) *LookupParams

func (*LookupParams) RootAddr

func (r *LookupParams) RootAddr() storage.Address

type Request

type Request struct {
	SignedResourceUpdate
	// contains filtered or unexported fields
}

func NewCreateRequest

func NewCreateRequest(metadata *ResourceMetadata) (request *Request, err error)

func NewCreateUpdateRequest

func NewCreateUpdateRequest(metadata *ResourceMetadata) (*Request, error)

func (*Request) Frequency

func (r *Request) Frequency() uint64

func (*Request) IsNew

func (r *Request) IsNew() bool

func (*Request) IsUpdate

func (r *Request) IsUpdate() bool

func (*Request) MarshalJSON

func (r *Request) MarshalJSON() (rawData []byte, err error)

func (*Request) Multihash

func (r *Request) Multihash() bool

func (*Request) Name

func (r *Request) Name() string

func (*Request) Owner

func (r *Request) Owner() common.Address

func (*Request) Period

func (r *Request) Period() uint32

func (*Request) RootAddr

func (r *Request) RootAddr() storage.Address

func (*Request) SetData

func (r *Request) SetData(data []byte, multihash bool)

func (*Request) Sign

func (r *Request) Sign(signer Signer) error

func (*Request) StartTime

func (r *Request) StartTime() Timestamp

func (*Request) UnmarshalJSON

func (r *Request) UnmarshalJSON(rawData []byte) error

func (*Request) Version

func (r *Request) Version() uint32

type ResourceMetadata

type ResourceMetadata struct {
	StartTime Timestamp      //
	Frequency uint64         //
	Name      string         //
	Owner     common.Address //
}

type Signature

type Signature [signatureLength]byte

type SignedResourceUpdate

type SignedResourceUpdate struct {
	// contains filtered or unexported fields
}

func (*SignedResourceUpdate) GetDigest

func (r *SignedResourceUpdate) GetDigest() (result common.Hash, err error)

func (*SignedResourceUpdate) Multihash

func (r *SignedResourceUpdate) Multihash() bool

func (*SignedResourceUpdate) Sign

func (r *SignedResourceUpdate) Sign(signer Signer) error

func (*SignedResourceUpdate) Verify

func (r *SignedResourceUpdate) Verify() (err error)

type Signer

type Signer interface {
	Sign(common.Hash) (Signature, error)
	Address() common.Address
}

type TestHandler

type TestHandler struct {
	*Handler
}

func NewTestHandler

func NewTestHandler(datadir string, params *HandlerParams) (*TestHandler, error)

func (*TestHandler) Close

func (t *TestHandler) Close()

type Timestamp

type Timestamp struct {
	Time uint64 //
}

type UpdateLookup

type UpdateLookup struct {
	// contains filtered or unexported fields
}

func (*UpdateLookup) UpdateAddr

func (u *UpdateLookup) UpdateAddr() (updateAddr storage.Address)

Jump to

Keyboard shortcuts

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