Versions in this module Expand all Collapse all v0 v0.0.1 Sep 2, 2021 Changes in this version + const DefaultProblemType + const ProblemMimetype + const ProblemNamespace + var AccountValueHint = hint.NewHint(AccountValueType, "v0.0.1") + var AccountValueType = hint.Type("mitum-currency-account-value") + var BaseHalHint = hint.NewHint(BaseHalType, "v0.0.1") + var BaseHalType = hint.Type("mitum-currency-hal") + var DefaultCacheExpire = time.Hour + var DigestStorageLastBlockKey = "digest_last_block" + var DocumentValueHint = hint.NewHint(DocumentValueType, "v0.0.1") + var DocumentValueType = hint.Type("mitum-blocksign-document-value") + var GlobalItemsLimit int64 = 10 + var HALJSONConfigDefault = ...() + var HALMimetype = "application/hal+json; charset=utf-8" + var HTTP2EncoderHintHeader = http.CanonicalHeaderKey("x-mitum-encoder-hint") + var HandlerPathAccount = `/account/{address:(?i)[0-9a-z][0-9a-z\-]+:[a-z0-9][a-z0-9\-_\+]*[a-z0-9]-v[0-9\.]*}` + var HandlerPathAccountDocuments = `/account/{address:(?i)[0-9a-z][0-9a-z\-]+:[a-z0-9][a-z0-9\-_\+]*[a-z0-9]-v[0-9\.]*}/documents` + var HandlerPathAccountOperations = `/account/{address:(?i)[0-9a-z][0-9a-z\-]+:[a-z0-9][a-z0-9\-_\+]*[a-z0-9]-v[0-9\.]*}/operations` + var HandlerPathBlockByHash = `/block/{hash:(?i)[0-9a-z][0-9a-z]+}` + var HandlerPathBlockByHeight = `/block/{height:[0-9]+}` + var HandlerPathCurrencies = `/currency` + var HandlerPathCurrency = `/currency/{currencyid:.*}` + var HandlerPathDocument = `/block/document/{documentid:[0-9]+}` + var HandlerPathDocuments = `/block/documents` + var HandlerPathDocumentsByHeight = `/block/{height:[0-9]+}/documents` + var HandlerPathManifestByHash = `/block/{hash:(?i)[0-9a-z][0-9a-z]+}/manifest` + var HandlerPathManifestByHeight = `/block/{height:[0-9]+}/manifest` + var HandlerPathManifests = `/block/manifests` + var HandlerPathNodeInfo = `/` + var HandlerPathOperation = `/block/operation/{hash:(?i)[0-9a-z][0-9a-z]+}` + var HandlerPathOperationBuild = `/builder/operation` + var HandlerPathOperationBuildFact = `/builder/operation/fact` + var HandlerPathOperationBuildFactTemplate = `/builder/operation/fact/template/{fact:[\w][\w\-]*}` + var HandlerPathOperationBuildSign = `/builder/operation/sign` + var HandlerPathOperations = `/block/operations` + var HandlerPathOperationsByHeight = `/block/{height:[0-9]+}/operations` + var HandlerPathSend = `/builder/send` + var NodeInfoHint = hint.NewHint(NodeInfoType, "v0.0.1") + var NodeInfoType = hint.Type("mitum-currency-node-info") + var OperationValueHint = hint.NewHint(OperationValueType, "v0.0.1") + var OperationValueType = hint.Type("mitum-currency-operation-value") + var ProblemHint = hint.NewHint(ProblemType, "v0.0.1") + var ProblemType = hint.Type("mitum-currency-problem") + var RateLimitHandlerMap = map[string]string + var SkipCacheError = util.NewError("skip cache") + var UnknownProblem = NewProblem(DefaultProblemType, "unknown problem occurred") + func CacheKey(key string, s ...string) string + func CacheKeyFromRequest(r *http.Request) string + func CacheKeyPath(r *http.Request) string + func DefaultItemsLimiter(string) int64 + func DigestBlock(st *Database, blk block.Block) error + func HTTP2HandleError(w http.ResponseWriter, err error) + func HTTP2NotSupported(w http.ResponseWriter, err error) + func HTTP2ProblemWithError(w http.ResponseWriter, err error, status int) + func HTTP2Stream(enc encoder.Encoder, w http.ResponseWriter, bufsize int, status int) (*jsoniter.Stream, func()) + func HTTP2WriteCache(w http.ResponseWriter, key string, expire time.Duration) + func HTTP2WriteHal(enc encoder.Encoder, w http.ResponseWriter, hal Hal, status int) + func HTTP2WriteHalBytes(enc encoder.Encoder, w http.ResponseWriter, b []byte, status int) + func HTTP2WritePoblem(w http.ResponseWriter, pr Problem, status int) + func IsAccountState(st state.State) (currency.Account, bool, error) + func IsBalanceState(st state.State) (currency.Amount, bool, error) + func IsDocumentState(st state.State) (blocksign.DocumentData, bool, error) + func LoadCurrenciesFromDatabase(st *mongodbstorage.Database, height base.Height, ...) error + func LoadFromCache(cache Cache, key string, w http.ResponseWriter) error + func MakeCacheKey(key string) string + func ScanCRLF(data []byte, atEOF bool) (int, []byte, error) + func WriteFromCache(b []byte, w http.ResponseWriter) error + type AccountDoc struct + func NewAccountDoc(rs AccountValue, enc encoder.Encoder) (AccountDoc, error) + func (doc AccountDoc) MarshalBSON() ([]byte, error) + type AccountValue struct + func NewAccountValue(st state.State) (AccountValue, error) + func (AccountValue) Hint() hint.Hint + func (va *AccountValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error + func (va *AccountValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error + func (va AccountValue) Account() currency.Account + func (va AccountValue) Balance() []currency.Amount + func (va AccountValue) Document() blocksign.DocumentInventory + func (va AccountValue) Height() base.Height + func (va AccountValue) MarshalBSON() ([]byte, error) + func (va AccountValue) MarshalJSON() ([]byte, error) + func (va AccountValue) PreviousHeight() base.Height + func (va AccountValue) SetBalance(balance []currency.Amount) AccountValue + func (va AccountValue) SetDocument(document blocksign.DocumentInventory) AccountValue + func (va AccountValue) SetHeight(height base.Height) AccountValue + func (va AccountValue) SetPreviousHeight(height base.Height) AccountValue + type AccountValueBSONUnpacker struct + AC bson.Raw + BL bson.Raw + DM bson.Raw + HT base.Height + PT base.Height + type AccountValueJSONPacker struct + BL []currency.Amount + DM blocksign.DocumentInventory + HT base.Height + PT base.Height + type AccountValueJSONUnpacker struct + BL json.RawMessage + DM json.RawMessage + HT base.Height + PT base.Height + type BalanceDoc struct + func NewBalanceDoc(st state.State, enc encoder.Encoder) (BalanceDoc, error) + func (doc BalanceDoc) MarshalBSON() ([]byte, error) + type BaseHal struct + func NewBaseHal(i interface{}, self HalLink) BaseHal + func (BaseHal) Hint() hint.Hint + func (hal *BaseHal) UnmarshalJSON(b []byte) error + func (hal BaseHal) AddExtras(key string, value interface{}) Hal + func (hal BaseHal) AddLink(rel string, link HalLink) Hal + func (hal BaseHal) Extras() map[string]interface{} + func (hal BaseHal) Interface() interface{} + func (hal BaseHal) Links() map[string]HalLink + func (hal BaseHal) MarshalJSON() ([]byte, error) + func (hal BaseHal) RawInterface() []byte + func (hal BaseHal) Self() HalLink + func (hal BaseHal) SetInterface(i interface{}) Hal + func (hal BaseHal) SetSelf(u HalLink) Hal + type BaseHalJSONPacker struct + EX map[string]interface{} + HINT hint.Hint + I interface{} + LS map[string]HalLink + type BaseHalJSONUnpacker struct + EX map[string]interface{} + LS map[string]HalLink + R json.RawMessage + type BlockSession struct + func NewBlockSession(st *Database, blk block.Block) (*BlockSession, error) + func (bs *BlockSession) Close() error + func (bs *BlockSession) Commit(ctx context.Context) error + func (bs *BlockSession) Prepare() error + type Builder struct + func NewBuilder(enc encoder.Encoder, networkID base.NetworkID) Builder + func (bl Builder) BuildFact(b []byte) (Hal, error) + func (bl Builder) BuildOperation(b []byte) (Hal, error) + func (bl Builder) FactTemplate(ht hint.Hint) (Hal, error) + type Cache interface + Get func(string) ([]byte, error) + Set func(string, []byte, time.Duration) error + func NewCacheFromURI(uri string) (Cache, error) + type CacheResponseWriter struct + func NewCacheResponseWriter(cache Cache, w http.ResponseWriter, r *http.Request) *CacheResponseWriter + func (cr *CacheResponseWriter) Cache() error + func (cr *CacheResponseWriter) Expire() time.Duration + func (cr *CacheResponseWriter) Key() string + func (cr *CacheResponseWriter) OK() bool + func (cr *CacheResponseWriter) SetExpire(expire time.Duration) *CacheResponseWriter + func (cr *CacheResponseWriter) SetKey(key string) *CacheResponseWriter + func (cr *CacheResponseWriter) SkipCache() *CacheResponseWriter + func (cr *CacheResponseWriter) Write(b []byte) (int, error) + func (cr *CacheResponseWriter) WriteHeader(status int) + type CachedHTTPHandler struct + func NewCachedHTTPHandler(cache Cache, f func(http.ResponseWriter, *http.Request)) CachedHTTPHandler + func (ch CachedHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) + type Database struct + func NewDatabase(mitum *mongodbstorage.Database, st *mongodbstorage.Database) (*Database, error) + func NewReadonlyDatabase(mitum *mongodbstorage.Database, st *mongodbstorage.Database) (*Database, error) + func (st *Database) Account(a base.Address) (AccountValue, bool, error) + func (st *Database) Clean() error + func (st *Database) CleanByHeight(height base.Height) error + func (st *Database) Close() error + func (st *Database) Document(i currency.Big) (DocumentValue, bool, error) + func (st *Database) Documents(filter bson.M, reverse bool, limit int64, ...) error + func (st *Database) DocumentsByAddress(address base.Address, reverse bool, offset string, limit int64, ...) error + func (st *Database) Initialize() error + func (st *Database) LastBlock() base.Height + func (st *Database) Manifest(h valuehash.Hash) (block.Manifest, bool, error) + func (st *Database) ManifestByHeight(height base.Height) (block.Manifest, bool, error) + func (st *Database) Manifests(load bool, reverse bool, offset base.Height, limit int64, ...) error + func (st *Database) New() (*Database, error) + func (st *Database) Operation(h valuehash.Hash, load bool) (OperationValue, bool, error) + func (st *Database) Operations(filter bson.M, load bool, reverse bool, limit int64, ...) error + func (st *Database) OperationsByAddress(address base.Address, load, reverse bool, offset string, limit int64, ...) error + func (st *Database) Readonly() bool + func (st *Database) SetLastBlock(height base.Height) error + type DigestError struct + func NewDigestError(err error, height base.Height) DigestError + func (de DigestError) Error() string + func (de DigestError) Height() base.Height + func (de DigestError) IsError() bool + type Digester struct + func NewDigester(st *Database, errChan chan error) *Digester + func (di *Digester) Digest(blocks []block.Block) + type DocumentDoc struct + func NewDocumentDoc(enc encoder.Encoder, doc blocksign.DocumentData, height base.Height) (DocumentDoc, error) + func (doc DocumentDoc) MarshalBSON() ([]byte, error) + type DocumentValue struct + func NewDocumentValue(doc blocksign.DocumentData, height base.Height) DocumentValue + func (dv *DocumentValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error + func (dv *DocumentValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error + func (dv DocumentValue) Document() blocksign.DocumentData + func (dv DocumentValue) Height() base.Height + func (dv DocumentValue) Hint() hint.Hint + func (dv DocumentValue) MarshalBSON() ([]byte, error) + func (va DocumentValue) MarshalJSON() ([]byte, error) + type DocumentValueBSONUnpacker struct + DM bson.Raw + HT base.Height + type DocumentValueJSONPacker struct + DM blocksign.DocumentData + HT base.Height + type DocumentValueJSONUnpacker struct + DM json.RawMessage + HT base.Height + type DocumentsDoc struct + func NewDocumentsDoc(st state.State, enc encoder.Encoder) (DocumentsDoc, error) + func (doc DocumentsDoc) MarshalBSON() ([]byte, error) + type DummyCache struct + func (DummyCache) Get(string) ([]byte, error) + func (DummyCache) Set(string, []byte, time.Duration) error + type HTTP2Server struct + func NewHTTP2Server(bind, host string, certs []tls.Certificate) (*HTTP2Server, error) + func (sv *HTTP2Server) Initialize() error + func (sv *HTTP2Server) Router() *mux.Router + func (sv *HTTP2Server) SetLogging(l *logging.Logging) *logging.Logging + func (sv *HTTP2Server) SetRouter(router *mux.Router) + type Hal interface + AddExtras func(string, interface{}) Hal + AddLink func(rel string, link HalLink) Hal + Extras func() map[string]interface{} + Interface func() interface{} + Links func() map[string]HalLink + RawInterface func() []byte + Self func() HalLink + SetInterface func(interface{}) Hal + SetSelf func(HalLink) Hal + type HalLink struct + func NewHalLink(href string, properties map[string]interface{}) HalLink + func (hl *HalLink) UnmarshalJSON(b []byte) error + func (hl HalLink) Href() string + func (hl HalLink) MarshalJSON() ([]byte, error) + func (hl HalLink) Properties() map[string]interface{} + func (hl HalLink) SetProperty(key string, value interface{}) HalLink + func (hl HalLink) SetTemplated() HalLink + func (hl HalLink) URL() (*url.URL, error) + type HalLinkJSONUnpacker struct + HR string + PR map[string]interface{} + type Handlers struct + func NewHandlers(networkID base.NetworkID, encs *encoder.Encoders, enc encoder.Encoder, ...) *Handlers + func (hd *Handlers) Cache() Cache + func (hd *Handlers) Handler() http.Handler + func (hd *Handlers) Initialize() error + func (hd *Handlers) Router() *mux.Router + func (hd *Handlers) SetLimiter(f func(string) int64) *Handlers + func (hd *Handlers) SetNodeInfoHandler(handler network.NodeInfoHandler) *Handlers + func (hd *Handlers) SetRateLimit(rules map[string][]process.RateLimitRule, store limiter.Store) *Handlers + func (hd *Handlers) SetSend(f func(interface{}) (seal.Seal, error)) *Handlers + type LocalMemCache struct + func NewLocalMemCache(size int, expire time.Duration) *LocalMemCache + func (ca *LocalMemCache) Get(key string) ([]byte, error) + func (ca *LocalMemCache) Set(key string, b []byte, expire time.Duration) error + type Memcached struct + func NewMemcached(servers ...string) (*Memcached, error) + func (mc *Memcached) Get(key string) ([]byte, error) + func (mc *Memcached) Set(key string, b []byte, expire time.Duration) error + type NodeInfo struct + func NewNodeInfo(ni network.NodeInfoV0) NodeInfo + func (NodeInfo) Hint() hint.Hint + func (ni *NodeInfo) UnpackBSON(b []byte, enc *bsonenc.Encoder) error + func (ni *NodeInfo) UnpackJSON(b []byte, enc *jsonenc.Encoder) error + func (ni NodeInfo) MarshalBSON() ([]byte, error) + func (ni NodeInfo) MarshalJSON() ([]byte, error) + func (ni NodeInfo) String() string + type NodeInfoPackerJSON struct + type OperationDoc struct + func NewOperationDoc(op operation.Operation, enc encoder.Encoder, height base.Height, ...) (OperationDoc, error) + func (doc OperationDoc) MarshalBSON() ([]byte, error) + type OperationValue struct + func NewOperationValue(op operation.Operation, height base.Height, confirmedAt time.Time, ...) OperationValue + func (OperationValue) Hint() hint.Hint + func (va *OperationValue) UnpackBSON(b []byte, enc *bsonenc.Encoder) error + func (va *OperationValue) UnpackJSON(b []byte, enc *jsonenc.Encoder) error + func (va OperationValue) ConfirmedAt() time.Time + func (va OperationValue) Height() base.Height + func (va OperationValue) InState() bool + func (va OperationValue) Index() uint64 + func (va OperationValue) MarshalBSON() ([]byte, error) + func (va OperationValue) MarshalJSON() ([]byte, error) + func (va OperationValue) Operation() operation.Operation + func (va OperationValue) Reason() operation.ReasonError + type OperationValueBSONUnpacker struct + CT time.Time + HT base.Height + ID uint64 + IN bool + OP bson.Raw + RS bson.Raw + type OperationValueJSONPacker struct + CF localtime.Time + HS valuehash.Hash + HT base.Height + ID uint64 + IN bool + OP operation.Operation + RS operation.ReasonError + type OperationValueJSONUnpacker struct + CF localtime.Time + HT base.Height + ID uint64 + IN bool + OP json.RawMessage + RS json.RawMessage + type Problem struct + func NewProblem(t, title string) Problem + func NewProblemFromError(err error) Problem + func (Problem) Hint() hint.Hint + func (pr *Problem) UnmarshalJSON(b []byte) error + func (pr Problem) Error() string + func (pr Problem) MarshalJSON() ([]byte, error) + func (pr Problem) SetDetail(detail string) Problem + func (pr Problem) SetExtra(key string, value interface{}) Problem + func (pr Problem) SetTitle(title string) Problem