Documentation
¶
Overview ¶
Package digest provides api features.
Index ¶
- Constants
- Variables
- func AddQueryValue(b, s string) string
- func CacheKey(key string, s ...string) string
- func CacheKeyFromRequest(r *http.Request) string
- func CacheKeyPath(r *http.Request) string
- func DIDData(db *Database, contract, key string) (*types.Data, base.State, error)
- func DIDDesign(st *Database, contract string) (types.Design, base.State, error)
- func DIDDocument(db *Database, contract, key string) (*types.DIDDocument, base.State, error)
- func DefaultItemsLimiter(string) int64
- func DigestBlock(ctx context.Context, st *Database, blk base.BlockMap, ops []base.Operation, ...) error
- func GenerateED25519PrivateKey() (ed25519.PrivateKey, error)
- func GenerateTLSCerts(host string, key ed25519.PrivateKey) ([]tls.Certificate, error)
- func GenerateTLSCertsPair(host string, key ed25519.PrivateKey) (*pem.Block, *pem.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 HTTP2WriteProblem(w http.ResponseWriter, pr Problem, status int)
- func IsAccountState(st base.State) (types.Account, bool, error)
- func IsBalanceState(st base.State) (types.Amount, bool, error)
- func LoadBalance(decoder func(interface{}) error, encs *encoder.Encoders) (base.State, error)
- func LoadContractAccountStatus(decoder func(interface{}) error, encs *encoder.Encoders) (base.State, error)
- func LoadCurrency(decoder func(interface{}) error, encs *encoder.Encoders) (base.State, error)
- func LoadFromCache(cache Cache, key string, w http.ResponseWriter) error
- func LoadManifest(decoder func(interface{}) error, encs *encoder.Encoders) (base.Manifest, uint64, string, string, uint64, error)
- func LoadOperationHash(decoder func(interface{}) error) (util.Hash, error)
- func LoadState(decoder func(interface{}) error, encs *encoder.Encoders) (base.State, error)
- func MakeCacheKey(key string) string
- func NodeInfo(client *isaacnetwork.BaseClient, connInfo quicstream.ConnInfo) (*isaacnetwork.NodeInfo, error)
- func ParseBoolQuery(s string) bool
- func ParseLimitQuery(s string) int64
- func ParseRequest(_ http.ResponseWriter, r *http.Request, v string) (string, error, int)
- func ParseStringQuery(s string) string
- func RateLimiter(rps int, burst int) func(http.Handler) http.Handler
- func ScanCRLF(data []byte, atEOF bool) (int, []byte, error)
- func StringBoolQuery(key string, v bool) string
- func StringOffsetQuery(offset string) string
- func WriteFromCache(b []byte, w http.ResponseWriter) error
- type AccountDoc
- type AccountValue
- func (va AccountValue) Account() types.Account
- func (va AccountValue) Balance() []types.Amount
- func (va AccountValue) ContractAccountStatus() types.ContractAccountStatus
- func (va *AccountValue) DecodeBSON(b []byte, enc *bsonenc.Encoder) error
- func (va *AccountValue) DecodeJSON(b []byte, enc encoder.Encoder) error
- func (va AccountValue) Height() base.Height
- func (va AccountValue) IsZeroValue() bool
- func (va AccountValue) MarshalBSON() ([]byte, error)
- func (va AccountValue) MarshalJSON() ([]byte, error)
- func (va AccountValue) SetBalance(balance []types.Amount) AccountValue
- func (va AccountValue) SetContractAccountStatus(status types.ContractAccountStatus) AccountValue
- func (va AccountValue) SetHeight(height base.Height) AccountValue
- type AccountValueBSONUnmarshaler
- type AccountValueJSONMarshaler
- type AccountValueJSONUnmarshaler
- type BalanceDoc
- type BaseHal
- 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
- func (hal *BaseHal) UnmarshalJSON(b []byte) error
- type BaseHalJSONMarshaler
- type BaseHalJSONUnpacker
- type BlockSession
- type BlockSessioner
- type Cache
- type 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
- type ContractAccountStatusDoc
- type CurrencyDoc
- type DIDDataDoc
- type DIDDocumentDoc
- type DIDRegistryDesignDoc
- type Database
- func (db *Database) Account(a base.Address) (AccountValue, bool, error)
- func (db *Database) AccountsByPublickey(pub base.Publickey, loadBalance bool, offsetHeight base.Height, ...) error
- func (db *Database) Clean() error
- func (db *Database) CleanByHeight(ctx context.Context, height base.Height) error
- func (db *Database) CleanByHeightColName(ctx context.Context, height base.Height, colName string, filters ...bson.D) error
- func (db *Database) Close() error
- func (db *Database) CreateIndex(dIndexes map[string][]mongo.IndexModel) error
- func (db *Database) Encoder() encoder.Encoder
- func (db *Database) Encoders() *encoder.Encoders
- func (db *Database) Initialize(dIndexes map[string][]mongo.IndexModel) error
- func (db *Database) LastBlock() base.Height
- func (db *Database) ManifestByHash(hash util.Hash) (base.Manifest, uint64, string, string, uint64, error)
- func (db *Database) ManifestByHeight(height base.Height) (base.Manifest, uint64, string, string, uint64, error)
- func (db *Database) Manifests(load bool, reverse bool, offset base.Height, limit int64, ...) error
- func (db *Database) MongoClient() *digestmongo.Client
- func (db *Database) New() (*Database, error)
- func (db *Database) Operation(h util.Hash, load bool) (OperationValue, bool, error)
- func (db *Database) Operations(filter bson.M, load bool, reverse bool, limit int64, ...) error
- func (db *Database) OperationsByAddress(address base.Address, load, reverse bool, offset string, limit int64, ...) error
- func (db *Database) OperationsByHash(filter bson.M, callback func(util.Hash, OperationValue, int64) (bool, error)) error
- func (db *Database) Readonly() bool
- func (db *Database) SetLastBlock(height base.Height) error
- type DigestError
- type Digester
- type DummyCache
- type ExpendedOperationMarshaler
- type ExpendedOperationValueJSONMarshaler
- type HTTP2Server
- func (sv *HTTP2Server) HandleRequest(wrapper RequestWrapper)
- func (sv *HTTP2Server) Initialize() error
- func (sv *HTTP2Server) Queue() chan RequestWrapper
- func (sv *HTTP2Server) Router() *mux.Router
- func (sv *HTTP2Server) SetEncoder(encs *encoder.Encoders)
- func (sv *HTTP2Server) SetNetworkClientFunc(...) *HTTP2Server
- func (sv *HTTP2Server) SetRouter(router *mux.Router)
- type Hal
- type HalLink
- 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)
- func (hl *HalLink) UnmarshalJSON(b []byte) error
- type HalLinkJSONUnpacker
- type 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) Routes() map[string]*mux.Route
- func (hd *Handlers) SetLimiter(f func(string) int64) *Handlers
- func (hd *Handlers) SetNetworkClientFunc(...) *Handlers
- func (hd *Handlers) SetNodeInfoHandler(handler NodeInfoHandler) *Handlers
- type LocalMemCache
- type LocalNetwork
- type ManifestDoc
- type ManifestValue
- type Memcached
- type NodeInfoHandler
- type OperationDoc
- type OperationValue
- func (va OperationValue) ConfirmedAt() time.Time
- func (va *OperationValue) DecodeBSON(b []byte, enc *bsonenc.Encoder) error
- func (va OperationValue) Height() base.Height
- func (OperationValue) Hint() hint.Hint
- func (va OperationValue) InState() bool
- func (va OperationValue) Index() uint64
- func (va OperationValue) IsZeroValue() bool
- func (va OperationValue) MarshalBSON() ([]byte, error)
- func (va OperationValue) MarshalJSON() ([]byte, error)
- func (va OperationValue) Operation() base.Operation
- func (va OperationValue) Reason() string
- type OperationValueBSONUnmarshaler
- type OperationValueJSONMarshaler
- type Problem
- type RequestWrapper
- type WriteModelPrepareFunc
- type YamlDigestDesign
- func (d *YamlDigestDesign) Cache() *url.URL
- func (d *YamlDigestDesign) Database() config.BaseDatabase
- func (d YamlDigestDesign) Equal(b YamlDigestDesign) bool
- func (d YamlDigestDesign) MarshalZerologObject(e *zerolog.Event)
- func (d *YamlDigestDesign) Network() config.LocalNetwork
- func (d *YamlDigestDesign) Set(ctx context.Context) (context.Context, error)
Constants ¶
const ( ExpireFilled = time.Second * 3 ExpireShortLived = time.Millisecond * 100 ExpireLongLived = time.Hour * 3000 )
const ( ProblemMimetype = "application/problem+json; charset=utf-8" ProblemNamespace = "https://github.com/ProtoconNet/mitum-currency/v3/problems" DefaultProblemType = "others" )
Variables ¶
var ( DefaultCacheExpire = time.Hour SkipCacheError = util.NewIDError("skip cache") )
var ( ContextValueDigestDesign util.ContextKey = "digest_design" ContextValueDigestDatabase util.ContextKey = "digest_database" ContextValueDigestNetwork util.ContextKey = "digest_network" ContextValueDigester util.ContextKey = "digester" ContextValueLocalNetwork util.ContextKey = "local_network" )
var ( DefaultColNameAccount = "digest_ac" DefaultColNameContractAccount = "digest_ca" DefaultColNameBalance = "digest_bl" DefaultColNameCurrency = "digest_cr" DefaultColNameOperation = "digest_op" DefaultColNameBlock = "digest_bm" )
var ( DefaultColNameDIDRegistry = "digest_did_registry" DefaultColNameDIDData = "digest_did_registry_data" DefaultColNameDIDDocument = "digest_did_registry_document" )
var ( DefaultDigestAPICache *url.URL DefaultDigestAPIBind string )
var ( DefaultDigestURL = "https://localhost:4430" DefaultDigestBind = "https://0.0.0.0:4430" )
var ( HTTP2EncoderHintHeader = http.CanonicalHeaderKey("x-mitum-encoder-hint") HALMimetype = "application/hal+json; charset=utf-8" )
var ( HandlerPathNodeInfo = `/` HandlerPathCurrencies = `/currency` HandlerPathCurrency = `/currency/{currency_id:` + types.ReCurrencyID + `}` HandlerPathManifests = `/block/manifests` HandlerPathOperations = `/block/operations` HandlerPathOperationsByHash = `/block/operations/facts` HandlerPathOperation = `/block/operation/{hash:(?i)[0-9a-z][0-9a-z]+}` HandlerPathBlockByHeight = `/block/{height:[0-9]+}` HandlerPathBlockByHash = `/block/{hash:(?i)[0-9a-z][0-9a-z]+}` HandlerPathOperationsByHeight = `/block/{height:[0-9]+}/operations` HandlerPathManifestByHeight = `/block/{height:[0-9]+}/manifest` HandlerPathManifestByHash = `/block/{hash:(?i)[0-9a-z][0-9a-z]+}/manifest` HandlerPathAccount = `/account/{address:(?i)` + types.REStringAddressString + `}` // revive:disable-line:line-length-limit HandlerPathAccountOperations = `/account/{address:(?i)` + types.REStringAddressString + `}/operations` // revive:disable-line:line-length-limit HandlerPathAccounts = `/accounts` HandlerPathOperationBuildFactTemplate = `/builder/operation/fact/template/{fact:[\w][\w\-]*}` HandlerPathOperationBuildFact = `/builder/operation/fact` HandlerPathOperationBuildSign = `/builder/operation/sign` HandlerPathOperationBuild = `/builder/operation` HandlerPathSend = `/builder/send` HandlerPathQueueSend = `/builder/send/queue` HandelrPathEventOperation = `/event/operation/{hash:(?i)[0-9a-z][0-9a-z]+}` HandelrPathEventAccount = `/event/account/{address:(?i)` + types.REStringAddressString + `}` HandlerPathEventContract = `/event/contract/{address:(?i)` + types.REStringAddressString + `}` )
var ( UnknownProblem = NewProblem(DefaultProblemType, "unknown problem occurred") UnknownProblemJSON []byte )
var ( HandlerPathDIDDesign = `/did-registry/{contract:(?i)` + types.REStringAddressString + `}` HandlerPathDIDData = `/did-registry/{contract:(?i)` + types.REStringAddressString + `}/did/{method_specific_id:` + types.ReSpecialCh + `}` HandlerPathDIDDocument = `/did-registry/{contract:(?i)` + types.REStringAddressString + `}/document` )
var AccountIndexModels = []mongo.IndexModel{ { Keys: bson.D{bson.E{Key: "address", Value: 1}, bson.E{Key: "height", Value: -1}}, Options: options.Index(). SetName("mitum_digest_account"), }, { Keys: bson.D{bson.E{Key: "height", Value: -1}}, Options: options.Index(). SetName("mitum_digest_account_height"), }, { Keys: bson.D{bson.E{Key: "pubs", Value: 1}, bson.E{Key: "height", Value: 1}, bson.E{Key: "address", Value: 1}}, Options: options.Index(). SetName("mitum_digest_account_publiskeys"), }, }
var (
AccountValueHint = hint.MustNewHint("mitum-currency-account-value-v0.0.1")
)
var AllCollections = []string{ DefaultColNameAccount, DefaultColNameBalance, DefaultColNameCurrency, DefaultColNameOperation, DefaultColNameBlock, }
var BalanceIndexModels = []mongo.IndexModel{ { Keys: bson.D{bson.E{Key: "address", Value: 1}, bson.E{Key: "height", Value: -1}}, Options: options.Index(). SetName("mitum_digest_balance"), }, { Keys: bson.D{ bson.E{Key: "address", Value: 1}, bson.E{Key: "currency", Value: 1}, bson.E{Key: "height", Value: -1}, }, Options: options.Index(). SetName("mitum_digest_balance_currency"), }, }
var (
BaseHalHint = hint.MustNewHint("mitum-currency-hal-v0.0.1")
)
var BlockIndexModels = []mongo.IndexModel{ { Keys: bson.D{bson.E{Key: "height", Value: -1}}, Options: options.Index(). SetName("mitum_digest_block_height"), }, }
var DefaultIndexes = map[string][]mongo.IndexModel{ DefaultColNameBlock: BlockIndexModels, DefaultColNameAccount: AccountIndexModels, DefaultColNameBalance: BalanceIndexModels, DefaultColNameOperation: OperationIndexModels, DefaultColNameDIDRegistry: DidRegistryIndexModels, DefaultColNameDIDData: DidRegistryDataIndexModels, DefaultColNameDIDDocument: DidRegistryDocumentIndexModels, }
var DidRegistryDataIndexModels = []mongo.IndexModel{ { Keys: bson.D{ bson.E{Key: "contract", Value: 1}, bson.E{Key: "method_specific_id", Value: 1}, bson.E{Key: "height", Value: -1}}, Options: options.Index(). SetName(IndexPrefix + "did_registry_data_contract_publicKey_height"), }, }
var DidRegistryDocumentIndexModels = []mongo.IndexModel{ { Keys: bson.D{ bson.E{Key: "contract", Value: 1}, bson.E{Key: "did", Value: 1}, bson.E{Key: "height", Value: -1}}, Options: options.Index(). SetName(IndexPrefix + "did_registry_document_contract_did_height"), }, }
var DidRegistryIndexModels = []mongo.IndexModel{ { Keys: bson.D{ bson.E{Key: "contract", Value: 1}, bson.E{Key: "height", Value: -1}}, Options: options.Index(). SetName(IndexPrefix + "did_registry_contract_height"), }, }
var DigestStorageLastBlockKey = "digest_last_block"
var (
ErrBadRequest = util.NewIDError("bad request")
)
var GlobalItemsLimit int64 = 10
var HALJSONConfigDefault = jsoniter.Config{ EscapeHTML: false, }.Froze()
var IndexPrefix = "mitum_digest_"
var JSON = jsoniter.Config{ EscapeHTML: true, SortMapKeys: false, ValidateJsonRawMessage: false, }.Froze()
var (
ManifestValueHint = hint.MustNewHint("mitum-currency-manifest-value-v0.0.1")
)
var OperationIndexModels = []mongo.IndexModel{ { Keys: bson.D{bson.E{Key: "addresses", Value: 1}, bson.E{Key: "height", Value: 1}, bson.E{Key: "index", Value: 1}}, Options: options.Index(). SetName("mitum_digest_account_operation"), }, { Keys: bson.D{bson.E{Key: "height", Value: 1}, bson.E{Key: "index", Value: 1}}, Options: options.Index(). SetName("mitum_digest_operation"), }, { Keys: bson.D{bson.E{Key: "height", Value: -1}}, Options: options.Index(). SetName("mitum_digest_operation_height"), }, }
var (
OperationValueHint = hint.MustNewHint("mitum-currency-operation-value-v0.0.1")
)
var (
ProblemHint = hint.MustNewHint("mitum-currency-problem-v0.0.1")
)
Functions ¶
func AddQueryValue ¶
func CacheKeyFromRequest ¶
func CacheKeyPath ¶
func DIDDocument ¶
func DefaultItemsLimiter ¶
func DigestBlock ¶
func GenerateED25519PrivateKey ¶
func GenerateED25519PrivateKey() (ed25519.PrivateKey, error)
func GenerateTLSCerts ¶
func GenerateTLSCerts(host string, key ed25519.PrivateKey) ([]tls.Certificate, error)
func GenerateTLSCertsPair ¶
func HTTP2HandleError ¶
func HTTP2HandleError(w http.ResponseWriter, err error)
func HTTP2NotSupported ¶
func HTTP2NotSupported(w http.ResponseWriter, err error)
func HTTP2ProblemWithError ¶
func HTTP2ProblemWithError(w http.ResponseWriter, err error, status int)
func HTTP2Stream ¶
func HTTP2WriteCache ¶
func HTTP2WriteCache(w http.ResponseWriter, key string, expire time.Duration)
func HTTP2WriteHal ¶
func HTTP2WriteHalBytes ¶
func HTTP2WriteProblem ¶
func HTTP2WriteProblem(w http.ResponseWriter, pr Problem, status int)
func LoadBalance ¶
func LoadCurrency ¶
func LoadFromCache ¶
func LoadFromCache(cache Cache, key string, w http.ResponseWriter) error
func LoadManifest ¶
func MakeCacheKey ¶
func NodeInfo ¶
func NodeInfo(client *isaacnetwork.BaseClient, connInfo quicstream.ConnInfo) (*isaacnetwork.NodeInfo, error)
func ParseBoolQuery ¶
func ParseLimitQuery ¶
func ParseRequest ¶
func ParseStringQuery ¶
func StringBoolQuery ¶
func StringOffsetQuery ¶
func WriteFromCache ¶
func WriteFromCache(b []byte, w http.ResponseWriter) error
Types ¶
type AccountDoc ¶
func NewAccountDoc ¶
func NewAccountDoc(rs AccountValue, enc encoder.Encoder) (AccountDoc, error)
func (AccountDoc) MarshalBSON ¶
func (doc AccountDoc) MarshalBSON() ([]byte, error)
type AccountValue ¶
type AccountValue struct { hint.BaseHinter // contains filtered or unexported fields }
func LoadAccountValue ¶
func LoadAccountValue(decoder func(interface{}) error, encs *encoder.Encoders) (AccountValue, error)
func NewAccountValue ¶
func NewAccountValue(st base.State) (AccountValue, error)
func (AccountValue) Account ¶
func (va AccountValue) Account() types.Account
func (AccountValue) Balance ¶
func (va AccountValue) Balance() []types.Amount
func (AccountValue) ContractAccountStatus ¶
func (va AccountValue) ContractAccountStatus() types.ContractAccountStatus
func (*AccountValue) DecodeBSON ¶
func (va *AccountValue) DecodeBSON(b []byte, enc *bsonenc.Encoder) error
func (*AccountValue) DecodeJSON ¶
func (va *AccountValue) DecodeJSON(b []byte, enc encoder.Encoder) error
func (AccountValue) Height ¶
func (va AccountValue) Height() base.Height
func (AccountValue) IsZeroValue ¶
func (va AccountValue) IsZeroValue() bool
func (AccountValue) MarshalBSON ¶
func (va AccountValue) MarshalBSON() ([]byte, error)
func (AccountValue) MarshalJSON ¶
func (va AccountValue) MarshalJSON() ([]byte, error)
func (AccountValue) SetBalance ¶
func (va AccountValue) SetBalance(balance []types.Amount) AccountValue
func (AccountValue) SetContractAccountStatus ¶
func (va AccountValue) SetContractAccountStatus(status types.ContractAccountStatus) AccountValue
func (AccountValue) SetHeight ¶
func (va AccountValue) SetHeight(height base.Height) AccountValue
type AccountValueJSONMarshaler ¶
type AccountValueJSONMarshaler struct { hint.BaseHinter types.AccountJSONMarshaler Balance []types.Amount `json:"balance,omitempty"` Height base.Height `json:"height"` ContractAccountStatus types.ContractAccountStatus `json:"contract_account_status"` }
type AccountValueJSONUnmarshaler ¶
type AccountValueJSONUnmarshaler struct { Hint hint.Hint Balance json.RawMessage `json:"balance"` Height base.Height `json:"height"` ContractAccountStatus json.RawMessage `json:"contract_account_status"` }
type BalanceDoc ¶
func NewBalanceDoc ¶
NewBalanceDoc gets the State of Amount
func (BalanceDoc) MarshalBSON ¶
func (doc BalanceDoc) MarshalBSON() ([]byte, error)
type BaseHal ¶
type BaseHal struct { hint.BaseHinter // contains filtered or unexported fields }
func NewBaseHal ¶
func NewEmptyHal ¶
func NewEmptyHal() BaseHal
func (BaseHal) MarshalJSON ¶
func (BaseHal) RawInterface ¶
func (BaseHal) SetInterface ¶
func (*BaseHal) UnmarshalJSON ¶
type BaseHalJSONMarshaler ¶
type BaseHalJSONMarshaler struct { hint.BaseHinter Embedded interface{} `json:"_embedded,omitempty"` Links map[string]HalLink `json:"_links,omitempty"` Extra map[string]interface{} `json:"_extra,omitempty"` }
type BaseHalJSONUnpacker ¶
type BaseHalJSONUnpacker struct { Embedded json.RawMessage `json:"_embedded,omitempty"` Links map[string]HalLink `json:"_links,omitempty"` Extra map[string]interface{} `json:"_extra,omitempty"` }
type BlockSession ¶
type BlockSession struct { sync.RWMutex WriteModels map[string][]mongo.WriteModel WriteModelsFunc map[string][]mongo.WriteModel // contains filtered or unexported fields }
func NewBlockSession ¶
func (*BlockSession) Close ¶
func (bs *BlockSession) Close() error
func (*BlockSession) Prepare ¶
func (bs *BlockSession) Prepare() error
type BlockSessioner ¶
type Cache ¶
func NewCacheFromURI ¶
type CacheResponseWriter ¶
type CacheResponseWriter struct { http.ResponseWriter // contains filtered or unexported fields }
func NewCacheResponseWriter ¶
func NewCacheResponseWriter(cache Cache, w http.ResponseWriter, r *http.Request) *CacheResponseWriter
func (*CacheResponseWriter) Cache ¶
func (cr *CacheResponseWriter) Cache() error
func (*CacheResponseWriter) Expire ¶
func (cr *CacheResponseWriter) Expire() time.Duration
func (*CacheResponseWriter) Key ¶
func (cr *CacheResponseWriter) Key() string
func (*CacheResponseWriter) OK ¶
func (cr *CacheResponseWriter) OK() bool
func (*CacheResponseWriter) SetExpire ¶
func (cr *CacheResponseWriter) SetExpire(expire time.Duration) *CacheResponseWriter
func (*CacheResponseWriter) SetKey ¶
func (cr *CacheResponseWriter) SetKey(key string) *CacheResponseWriter
func (*CacheResponseWriter) SkipCache ¶
func (cr *CacheResponseWriter) SkipCache() *CacheResponseWriter
func (*CacheResponseWriter) WriteHeader ¶
func (cr *CacheResponseWriter) WriteHeader(status int)
type CachedHTTPHandler ¶
func NewCachedHTTPHandler ¶
func NewCachedHTTPHandler(cache Cache, f func(http.ResponseWriter, *http.Request)) CachedHTTPHandler
func (CachedHTTPHandler) ServeHTTP ¶
func (ch CachedHTTPHandler) ServeHTTP(w http.ResponseWriter, r *http.Request)
type ContractAccountStatusDoc ¶
type ContractAccountStatusDoc struct { mongodbst.BaseDoc // contains filtered or unexported fields }
func (ContractAccountStatusDoc) MarshalBSON ¶
func (doc ContractAccountStatusDoc) MarshalBSON() ([]byte, error)
type CurrencyDoc ¶
func NewCurrencyDoc ¶
func (CurrencyDoc) MarshalBSON ¶
func (doc CurrencyDoc) MarshalBSON() ([]byte, error)
type DIDDataDoc ¶
func NewDIDDataDoc ¶
func (DIDDataDoc) MarshalBSON ¶
func (doc DIDDataDoc) MarshalBSON() ([]byte, error)
type DIDDocumentDoc ¶
func NewDIDDocumentDoc ¶
func (DIDDocumentDoc) MarshalBSON ¶
func (doc DIDDocumentDoc) MarshalBSON() ([]byte, error)
type DIDRegistryDesignDoc ¶
func NewDIDRegistryDesignDoc ¶
NewDIDRegistryDesignDoc get the State of DID Design
func (DIDRegistryDesignDoc) MarshalBSON ¶
func (doc DIDRegistryDesignDoc) MarshalBSON() ([]byte, error)
type Database ¶
func NewDatabase ¶
func NewDatabase(mitumDB *isaacdatabase.Center, digestDB *digestmongo.Database) (*Database, error)
func NewReadonlyDatabase ¶
func NewReadonlyDatabase(mitumDB *isaacdatabase.Center, digestDB *digestmongo.Database) (*Database, error)
func (*Database) AccountsByPublickey ¶
func (db *Database) AccountsByPublickey( pub base.Publickey, loadBalance bool, offsetHeight base.Height, offsetAddress string, limit int64, callback func(AccountValue) (bool, error), ) error
AccountsByPublickey finds Accounts, which are related with the given Publickey. * offset: returns from next of offset, usually it is "<height>,<address>".
func (*Database) CleanByHeight ¶
func (*Database) CleanByHeightColName ¶
func (*Database) CreateIndex ¶
func (db *Database) CreateIndex(dIndexes map[string][]mongo.IndexModel) error
func (*Database) Initialize ¶
func (db *Database) Initialize(dIndexes map[string][]mongo.IndexModel) error
func (*Database) ManifestByHash ¶
func (*Database) ManifestByHeight ¶
func (*Database) Manifests ¶
func (db *Database) Manifests( load bool, reverse bool, offset base.Height, limit int64, callback func(base.Height, base.Manifest, uint64, string, string, uint64) (bool, error), ) error
Manifests returns block.Manifests by order and height.
func (*Database) MongoClient ¶
func (db *Database) MongoClient() *digestmongo.Client
func (*Database) Operation ¶
Operation returns operation.Operation. If load is false, just returns nil Operation.
func (*Database) Operations ¶
func (db *Database) Operations( filter bson.M, load bool, reverse bool, limit int64, callback func(util.Hash, OperationValue, int64) (bool, error), ) error
Operations returns operation.Operations by order, height and index.
func (*Database) OperationsByAddress ¶
func (db *Database) OperationsByAddress( address base.Address, load, reverse bool, offset string, limit int64, callback func(util.Hash, OperationValue) (bool, error), ) error
OperationsByAddress finds the operation.Operations, which are related with the given Address. The returned valuehash.Hash is the operation.Operation.Fact().Hash(). * load:if true, load operation.Operation and returns it. If not, just hash will be returned * reverse: order by height; if true, higher height will be returned first. * offset: returns from next of offset, usually it is combination of "<height>,<fact>".
type DigestError ¶
type DigestError struct {
// contains filtered or unexported fields
}
func NewDigestError ¶
func NewDigestError(err error, height base.Height) DigestError
func (DigestError) Error ¶
func (de DigestError) Error() string
func (DigestError) Height ¶
func (de DigestError) Height() base.Height
func (DigestError) IsError ¶
func (de DigestError) IsError() bool
type Digester ¶
type Digester struct { sync.RWMutex *util.ContextDaemon *logging.Logging // contains filtered or unexported fields }
func NewDigester ¶
type DummyCache ¶
type DummyCache struct{}
type ExpendedOperationMarshaler ¶
type ExpendedOperationMarshaler struct { common.BaseOperationJSONMarshaler extras.BaseOperationExtensionsJSONMarshaler }
type ExpendedOperationValueJSONMarshaler ¶
type ExpendedOperationValueJSONMarshaler struct { hint.BaseHinter Hash util.Hash `json:"hash"` Operation ExpendedOperationMarshaler `json:"operation"` Height base.Height `json:"height"` ConfirmedAt localtime.Time `json:"confirmed_at"` Reason string `json:"reason"` InState bool `json:"in_state"` Index uint64 `json:"index"` }
type HTTP2Server ¶
type HTTP2Server struct { sync.RWMutex *logging.Logging *util.ContextDaemon // contains filtered or unexported fields }
func NewHTTP2Server ¶
func NewHTTP2Server( bind, host string, certs []tls.Certificate, encs *encoder.Encoders, networkID base.NetworkID, ) (*HTTP2Server, error)
func (*HTTP2Server) HandleRequest ¶
func (sv *HTTP2Server) HandleRequest(wrapper RequestWrapper)
func (*HTTP2Server) Initialize ¶
func (sv *HTTP2Server) Initialize() error
func (*HTTP2Server) Queue ¶
func (sv *HTTP2Server) Queue() chan RequestWrapper
func (*HTTP2Server) Router ¶
func (sv *HTTP2Server) Router() *mux.Router
func (*HTTP2Server) SetEncoder ¶
func (sv *HTTP2Server) SetEncoder(encs *encoder.Encoders)
func (*HTTP2Server) SetNetworkClientFunc ¶
func (sv *HTTP2Server) SetNetworkClientFunc(f func() (*isaacnetwork.BaseClient, *quicmemberlist.Memberlist, []quicstream.ConnInfo, error)) *HTTP2Server
func (*HTTP2Server) SetRouter ¶
func (sv *HTTP2Server) SetRouter(router *mux.Router)
type HalLink ¶
type HalLink struct {
// contains filtered or unexported fields
}
func NewHalLink ¶
func (HalLink) MarshalJSON ¶
func (HalLink) Properties ¶
func (HalLink) SetProperty ¶
func (HalLink) SetTemplated ¶
func (*HalLink) UnmarshalJSON ¶
type HalLinkJSONUnpacker ¶
type Handlers ¶
func NewHandlers ¶
func (*Handlers) Initialize ¶
func (*Handlers) SetNetworkClientFunc ¶
func (hd *Handlers) SetNetworkClientFunc(f func() (*quicstream.ConnectionPool, *quicmemberlist.Memberlist, []quicstream.ConnInfo, error)) *Handlers
func (*Handlers) SetNodeInfoHandler ¶
func (hd *Handlers) SetNodeInfoHandler(handler NodeInfoHandler) *Handlers
type LocalMemCache ¶
type LocalMemCache struct {
// contains filtered or unexported fields
}
func NewLocalMemCache ¶
func NewLocalMemCache(size int, expire time.Duration) *LocalMemCache
type LocalNetwork ¶
type ManifestDoc ¶
func NewManifestDoc ¶
func (ManifestDoc) MarshalBSON ¶
func (doc ManifestDoc) MarshalBSON() ([]byte, error)
type ManifestValue ¶
type ManifestValue struct { hint.BaseHinter // contains filtered or unexported fields }
func NewManifestValue ¶
func (ManifestValue) ConfirmedAt ¶
func (va ManifestValue) ConfirmedAt() time.Time
func (ManifestValue) Height ¶
func (va ManifestValue) Height() base.Height
func (ManifestValue) Hint ¶
func (ManifestValue) Hint() hint.Hint
func (ManifestValue) Manifest ¶
func (va ManifestValue) Manifest() base.Manifest
type Memcached ¶
type Memcached struct {
// contains filtered or unexported fields
}
func NewMemcached ¶
type NodeInfoHandler ¶
type NodeInfoHandler func() (isaacnetwork.NodeInfo, error)
type OperationDoc ¶
func NewOperationDoc ¶
func (OperationDoc) MarshalBSON ¶
func (doc OperationDoc) MarshalBSON() ([]byte, error)
type OperationValue ¶
type OperationValue struct { hint.BaseHinter // contains filtered or unexported fields }
func LoadOperation ¶
func LoadOperation(decoder func(interface{}) error, encs *encoder.Encoders) (OperationValue, error)
func NewOperationValue ¶
func (OperationValue) ConfirmedAt ¶
func (va OperationValue) ConfirmedAt() time.Time
func (*OperationValue) DecodeBSON ¶
func (va *OperationValue) DecodeBSON(b []byte, enc *bsonenc.Encoder) error
func (OperationValue) Height ¶
func (va OperationValue) Height() base.Height
func (OperationValue) Hint ¶
func (OperationValue) Hint() hint.Hint
func (OperationValue) InState ¶
func (va OperationValue) InState() bool
func (OperationValue) Index ¶
func (va OperationValue) Index() uint64
Index indicates the index number of Operation in OperationTree of block.
func (OperationValue) IsZeroValue ¶
func (va OperationValue) IsZeroValue() bool
func (OperationValue) MarshalBSON ¶
func (va OperationValue) MarshalBSON() ([]byte, error)
func (OperationValue) MarshalJSON ¶
func (va OperationValue) MarshalJSON() ([]byte, error)
func (OperationValue) Operation ¶
func (va OperationValue) Operation() base.Operation
func (OperationValue) Reason ¶
func (va OperationValue) Reason() string
type OperationValueJSONMarshaler ¶
type OperationValueJSONMarshaler struct { hint.BaseHinter Hash util.Hash `json:"hash"` Operation common.BaseOperationJSONMarshaler `json:"operation"` Height base.Height `json:"height"` ConfirmedAt localtime.Time `json:"confirmed_at"` Reason string `json:"reason"` InState bool `json:"in_state"` Index uint64 `json:"index"` }
type Problem ¶
type Problem struct {
// contains filtered or unexported fields
}
Problem implements "Problem Details for HTTP APIs"<https://tools.ietf.org/html/rfc7807>.
func NewProblem ¶
func NewProblemFromError ¶
type RequestWrapper ¶
type RequestWrapper struct {
// contains filtered or unexported fields
}
type WriteModelPrepareFunc ¶
type WriteModelPrepareFunc func(BlockSession, base.State) ([]mongo.WriteModel, error)
type YamlDigestDesign ¶
type YamlDigestDesign struct { NetworkYAML *LocalNetwork `yaml:"network,omitempty"` CacheYAML *string `yaml:"cache,omitempty"` DatabaseYAML *config.DatabaseYAML `yaml:"database"` ConnInfo []quicstream.ConnInfo `yaml:"conn_info,omitempty"` // contains filtered or unexported fields }
func (*YamlDigestDesign) Cache ¶
func (d *YamlDigestDesign) Cache() *url.URL
func (*YamlDigestDesign) Database ¶
func (d *YamlDigestDesign) Database() config.BaseDatabase
func (YamlDigestDesign) Equal ¶
func (d YamlDigestDesign) Equal(b YamlDigestDesign) bool
func (YamlDigestDesign) MarshalZerologObject ¶
func (d YamlDigestDesign) MarshalZerologObject(e *zerolog.Event)
func (*YamlDigestDesign) Network ¶
func (d *YamlDigestDesign) Network() config.LocalNetwork
Source Files
¶
- account_value.go
- account_value_bson.go
- account_value_encode.go
- account_value_json.go
- block_session.go
- block_session_did_registry_handler.go
- cache.go
- context.go
- database.go
- database_did_registry.go
- decode.go
- design.go
- digest.go
- doc.go
- doc_account.go
- doc_currency.go
- doc_did_registry.go
- doc_manifest.go
- doc_operation.go
- hal.go
- hal_json.go
- handler.go
- handler_account.go
- handler_block.go
- handler_currency.go
- handler_did_registry.go
- handler_event.go
- handler_manifest.go
- handler_node_info.go
- handler_operation.go
- handler_send.go
- index.go
- local_network.go
- manifest_value.go
- manifest_value_bson.go
- operation_value.go
- operation_value_bson.go
- operation_value_json.go
- problem.go
- server.go
- set_networkclient.go
- util.go