CovenantSQL: github.com/CovenantSQL/CovenantSQL/types Index | Files

package types

import "github.com/CovenantSQL/CovenantSQL/types"

Package types defines commonly used types for sql-chain.

Index

Package Files

account.go account_gen.go ack_type.go ack_type_gen.go baseaccount.go baseaccount_gen.go block.go block_gen.go bp_block.go bp_block_gen.go bprpc.go createdb.go createdb_gen.go db_service_types.go db_service_types_gen.go doc.go errors.go init_service_type.go init_service_type_gen.go issuekeys.go issuekeys_gen.go observer.go provideservice.go provideservice_gen.go request_type.go request_type_gen.go response_type.go response_type_gen.go token.go token_gen.go transfer.go transfer_gen.go update_service_type.go update_service_type_gen.go updatebilling.go updatebilling_gen.go updatebilling_updatebillingheader_9ef447_gen.go updatebilling_updatebillingheader_oldver_gen.go updatepermission.go updatepermission_gen.go util.go

Constants

const (
    // Read defines the read user permission.
    Read UserPermissionRole = 1 << iota
    // Write defines the writer user permission.
    Write
    // Super defines the super user permission.
    Super
    // Invalid defines the invalid permission
    Invalid

    // ReadOnly defines the reader user permission.
    ReadOnly = Read
    // WriteOnly defines the writer user permission.
    WriteOnly = Write
    // ReadWrite defines the reader && writer user permission.
    ReadWrite = Read | Write
    // Admin defines the privilege to full control the database.
    Admin = Read | Write | Super

    // Void defines the initial permission.
    Void UserPermissionRole = 0
)
const (
    // ReplicateFromBeginning is the replication offset observes from genesis block.
    ReplicateFromBeginning = int32(0)
    // ReplicateFromNewest is the replication offset observes from block head of current node.
    ReplicateFromNewest = int32(-1)
)

Variables

var (
    // ErrMerkleRootVerification indicates a failed merkle root verificatin.
    ErrMerkleRootVerification = errors.New("merkle root verification failed")
    // ErrNodePublicKeyNotMatch indicates that the public key given with a node does not match the
    // one in the key store.
    ErrNodePublicKeyNotMatch = errors.New("node publick key doesn't match")
    // ErrSignVerification indicates a failed signature verification.
    ErrSignVerification = errors.New("signature verification failed")
    // ErrBillingNotMatch indicates that the billing request doesn't match the local result.
    ErrBillingNotMatch = errors.New("billing request doesn't match")
    // ErrHashVerification indicates a failed hash verification.
    ErrHashVerification = errors.New("hash verification failed")
    // ErrInvalidGenesis indicates a failed genesis block verification.
    ErrInvalidGenesis = errors.New("invalid genesis block")
)
var TokenList = map[TokenType]string{
    Particle: "Particle",
    Wave:     "Wave",
    Ether:    "Ether",
    EOS:      "EOS",
    Bitcoin:  "Bitcoin",
}

TokenList lists supporting token.

type Account Uses

type Account struct {
    Address      proto.AccountAddress
    TokenBalance [SupportTokenNumber]uint64
    Rating       float64
    NextNonce    pi.AccountNonce
}

Account store its balance, and other mate data.

func (*Account) MarshalHash Uses

func (z *Account) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*Account) Msgsize Uses

func (z *Account) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type Ack Uses

type Ack struct {
    proto.Envelope
    Header SignedAckHeader `json:"h"`
}

Ack defines a whole client ack request entity.

func (*Ack) MarshalHash Uses

func (z *Ack) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*Ack) Msgsize Uses

func (z *Ack) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Ack) Sign Uses

func (a *Ack) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*Ack) Verify Uses

func (a *Ack) Verify() error

Verify checks hash and signature in ack.

type AckHeader Uses

type AckHeader struct {
    Response     ResponseHeader `json:"r"`
    ResponseHash hash.Hash      `json:"rh"`
    NodeID       proto.NodeID   `json:"i"` // ack node id
    Timestamp    time.Time      `json:"t"` // time in UTC zone
}

AckHeader defines client ack entity.

func (*AckHeader) GetQueryKey Uses

func (h *AckHeader) GetQueryKey() QueryKey

GetQueryKey returns the request query key.

func (*AckHeader) GetRequestHash Uses

func (h *AckHeader) GetRequestHash() hash.Hash

GetRequestHash returns the request hash.

func (*AckHeader) GetRequestTimestamp Uses

func (h *AckHeader) GetRequestTimestamp() time.Time

GetRequestTimestamp returns the request timestamp.

func (*AckHeader) GetResponseHash Uses

func (h *AckHeader) GetResponseHash() hash.Hash

GetResponseHash returns the response hash.

func (*AckHeader) GetResponseTimestamp Uses

func (h *AckHeader) GetResponseTimestamp() time.Time

GetResponseTimestamp returns the response timestamp.

func (*AckHeader) MarshalHash Uses

func (z *AckHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*AckHeader) Msgsize Uses

func (z *AckHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type AckResponse Uses

type AckResponse struct{}

AckResponse defines client ack response entity.

func (AckResponse) MarshalHash Uses

func (z AckResponse) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (AckResponse) Msgsize Uses

func (z AckResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type AddTxReq Uses

type AddTxReq struct {
    proto.Envelope

    TTL uint32 // defines the broadcast TTL on BP network.
    Tx  interfaces.Transaction
}

AddTxReq defines a request of the AddTx RPC method.

type AddTxResp Uses

type AddTxResp struct {
    proto.Envelope
}

AddTxResp defines a response of the AddTx RPC method.

type AdviseNewBlockReq Uses

type AdviseNewBlockReq struct {
    proto.Envelope
    Block *BPBlock
}

AdviseNewBlockReq defines a request of the AdviseNewBlock RPC method.

type AdviseNewBlockResp Uses

type AdviseNewBlockResp struct {
    proto.Envelope
}

AdviseNewBlockResp defines a response of the AdviseNewBlock RPC method.

type BPBlock Uses

type BPBlock struct {
    SignedHeader BPSignedHeader
    Transactions []pi.Transaction
}

BPBlock defines the main chain block.

func (*BPBlock) BlockHash Uses

func (b *BPBlock) BlockHash() *hash.Hash

BlockHash returns the parent hash field of the block header.

func (*BPBlock) GetTxHashes Uses

func (b *BPBlock) GetTxHashes() []*hash.Hash

GetTxHashes returns all hashes of tx in block.{Billings, ...}.

func (*BPBlock) MarshalHash Uses

func (z *BPBlock) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*BPBlock) Msgsize Uses

func (z *BPBlock) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BPBlock) PackAndSignBlock Uses

func (b *BPBlock) PackAndSignBlock(signer *asymmetric.PrivateKey) error

PackAndSignBlock computes block's hash and sign it.

func (*BPBlock) ParentHash Uses

func (b *BPBlock) ParentHash() *hash.Hash

ParentHash returns the parent hash field of the block header.

func (*BPBlock) Producer Uses

func (b *BPBlock) Producer() proto.AccountAddress

Producer returns the producer of block.

func (*BPBlock) SetHash Uses

func (b *BPBlock) SetHash() error

SetHash sets the block header hash, including the merkle root of the packed transactions.

func (*BPBlock) Timestamp Uses

func (b *BPBlock) Timestamp() time.Time

Timestamp returns timestamp of block.

func (*BPBlock) Verify Uses

func (b *BPBlock) Verify() error

Verify verifies whether the block is valid.

func (*BPBlock) VerifyHash Uses

func (b *BPBlock) VerifyHash() error

VerifyHash verifies the block header hash, including the merkle root of the packed transactions.

type BPHeader Uses

type BPHeader struct {
    Version    int32
    Producer   proto.AccountAddress
    MerkleRoot hash.Hash
    ParentHash hash.Hash
    Timestamp  time.Time
}

BPHeader defines the main chain block header.

func (*BPHeader) MarshalHash Uses

func (z *BPHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*BPHeader) Msgsize Uses

func (z *BPHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type BPSignedHeader Uses

type BPSignedHeader struct {
    BPHeader
    verifier.DefaultHashSignVerifierImpl
}

BPSignedHeader defines the main chain header with the signature.

func (*BPSignedHeader) MarshalHash Uses

func (z *BPSignedHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*BPSignedHeader) Msgsize Uses

func (z *BPSignedHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type BaseAccount Uses

type BaseAccount struct {
    Account
    pi.TransactionTypeMixin
}

BaseAccount defines the base account type header.

func NewBaseAccount Uses

func NewBaseAccount(account *Account) *BaseAccount

NewBaseAccount returns new instance.

func (*BaseAccount) GetAccountAddress Uses

func (b *BaseAccount) GetAccountAddress() proto.AccountAddress

GetAccountAddress implements interfaces/Transaction.GetAccountAddress.

func (*BaseAccount) GetAccountNonce Uses

func (b *BaseAccount) GetAccountNonce() pi.AccountNonce

GetAccountNonce implements interfaces/Transaction.GetAccountNonce.

func (*BaseAccount) Hash Uses

func (b *BaseAccount) Hash() (h hash.Hash)

Hash implements interfaces/Transaction.Hash.

func (*BaseAccount) MarshalHash Uses

func (z *BaseAccount) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*BaseAccount) Msgsize Uses

func (z *BaseAccount) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*BaseAccount) Sign Uses

func (b *BaseAccount) Sign(signer *asymmetric.PrivateKey) (err error)

Sign implements interfaces/Transaction.Sign.

func (*BaseAccount) Verify Uses

func (b *BaseAccount) Verify() (err error)

Verify implements interfaces/Transaction.Verify.

type Block Uses

type Block struct {
    SignedHeader SignedHeader
    FailedReqs   []*Request
    QueryTxs     []*QueryAsTx
    Acks         []*SignedAckHeader
}

Block is a node of blockchain.

func CreateRandomBlock Uses

func CreateRandomBlock(parent hash.Hash, isGenesis bool) (b *Block, err error)

CreateRandomBlock create a new random block

func (*Block) BlockHash Uses

func (b *Block) BlockHash() *hash.Hash

BlockHash returns the parent hash field of the block header.

func (*Block) CalcNextID Uses

func (b *Block) CalcNextID() (id uint64, ok bool)

CalcNextID calculates the next query id by examinating every query in block, and adds write query number to the last offset.

TODO(leventeliu): too tricky. Consider simply adding next id to each block header.

func (*Block) GenesisHash Uses

func (b *Block) GenesisHash() *hash.Hash

GenesisHash returns the parent hash field of the block header.

func (*Block) MarshalHash Uses

func (z *Block) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*Block) Msgsize Uses

func (z *Block) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Block) PackAndSignBlock Uses

func (b *Block) PackAndSignBlock(signer *ca.PrivateKey) (err error)

PackAndSignBlock generates the signature for the Block from the given PrivateKey.

func (*Block) PackAsGenesis Uses

func (b *Block) PackAsGenesis() (err error)

PackAsGenesis generates the hash of the genesis block.

func (*Block) ParentHash Uses

func (b *Block) ParentHash() *hash.Hash

ParentHash returns the parent hash field of the block header.

func (*Block) Producer Uses

func (b *Block) Producer() proto.NodeID

Producer returns the producer field of the block header.

func (*Block) Signee Uses

func (b *Block) Signee() *ca.PublicKey

Signee returns the signee field of the block signed header.

func (*Block) Timestamp Uses

func (b *Block) Timestamp() time.Time

Timestamp returns the timestamp field of the block header.

func (*Block) Verify Uses

func (b *Block) Verify() (err error)

Verify verifies the merkle root and header signature of the block.

func (*Block) VerifyAsGenesis Uses

func (b *Block) VerifyAsGenesis() (err error)

VerifyAsGenesis verifies the block as a genesis block.

type Blocks Uses

type Blocks []*Block

Blocks is Block (reference) array.

func (Blocks) MarshalHash Uses

func (z Blocks) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (Blocks) Msgsize Uses

func (z Blocks) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type CreateDatabase Uses

type CreateDatabase struct {
    CreateDatabaseHeader
    pi.TransactionTypeMixin
    verifier.DefaultHashSignVerifierImpl
}

CreateDatabase defines the database creation transaction.

func NewCreateDatabase Uses

func NewCreateDatabase(header *CreateDatabaseHeader) *CreateDatabase

NewCreateDatabase returns new instance.

func (*CreateDatabase) GetAccountAddress Uses

func (cd *CreateDatabase) GetAccountAddress() proto.AccountAddress

GetAccountAddress implements interfaces/Transaction.GetAccountAddress.

func (*CreateDatabase) MarshalHash Uses

func (z *CreateDatabase) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*CreateDatabase) Msgsize Uses

func (z *CreateDatabase) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CreateDatabase) Sign Uses

func (cd *CreateDatabase) Sign(signer *asymmetric.PrivateKey) (err error)

Sign implements interfaces/Transaction.Sign.

func (*CreateDatabase) Verify Uses

func (cd *CreateDatabase) Verify() error

Verify implements interfaces/Transaction.Verify.

type CreateDatabaseHeader Uses

type CreateDatabaseHeader struct {
    Owner          proto.AccountAddress
    ResourceMeta   ResourceMeta
    GasPrice       uint64
    AdvancePayment uint64
    TokenType      TokenType
    Nonce          pi.AccountNonce
}

CreateDatabaseHeader defines the database creation transaction header.

func (*CreateDatabaseHeader) GetAccountNonce Uses

func (h *CreateDatabaseHeader) GetAccountNonce() pi.AccountNonce

GetAccountNonce implements interfaces/Transaction.GetAccountNonce.

func (*CreateDatabaseHeader) MarshalHash Uses

func (z *CreateDatabaseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*CreateDatabaseHeader) Msgsize Uses

func (z *CreateDatabaseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type CreateDatabaseRequest Uses

type CreateDatabaseRequest struct {
    proto.Envelope
    Header SignedCreateDatabaseRequestHeader
}

CreateDatabaseRequest defines client create database rpc request entity.

func (*CreateDatabaseRequest) MarshalHash Uses

func (z *CreateDatabaseRequest) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*CreateDatabaseRequest) Msgsize Uses

func (z *CreateDatabaseRequest) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CreateDatabaseRequest) Sign Uses

func (r *CreateDatabaseRequest) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*CreateDatabaseRequest) Verify Uses

func (r *CreateDatabaseRequest) Verify() error

Verify checks hash and signature in request header.

type CreateDatabaseRequestHeader Uses

type CreateDatabaseRequestHeader struct {
    ResourceMeta ResourceMeta
}

CreateDatabaseRequestHeader defines client create database rpc header.

func (*CreateDatabaseRequestHeader) MarshalHash Uses

func (z *CreateDatabaseRequestHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*CreateDatabaseRequestHeader) Msgsize Uses

func (z *CreateDatabaseRequestHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type CreateDatabaseResponse Uses

type CreateDatabaseResponse struct {
    proto.Envelope
    Header SignedCreateDatabaseResponseHeader
}

CreateDatabaseResponse defines client create database rpc response entity.

func (*CreateDatabaseResponse) MarshalHash Uses

func (z *CreateDatabaseResponse) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*CreateDatabaseResponse) Msgsize Uses

func (z *CreateDatabaseResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*CreateDatabaseResponse) Sign Uses

func (r *CreateDatabaseResponse) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the response.

func (*CreateDatabaseResponse) Verify Uses

func (r *CreateDatabaseResponse) Verify() error

Verify checks hash and signature in response header.

type CreateDatabaseResponseHeader Uses

type CreateDatabaseResponseHeader struct {
    InstanceMeta ServiceInstance
}

CreateDatabaseResponseHeader defines client create database rpc response header.

func (*CreateDatabaseResponseHeader) MarshalHash Uses

func (z *CreateDatabaseResponseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*CreateDatabaseResponseHeader) Msgsize Uses

func (z *CreateDatabaseResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type DropDatabaseRequest Uses

type DropDatabaseRequest struct {
    proto.Envelope
    Header SignedDropDatabaseRequestHeader
}

DropDatabaseRequest defines client drop database rpc request entity.

func (*DropDatabaseRequest) MarshalHash Uses

func (z *DropDatabaseRequest) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*DropDatabaseRequest) Msgsize Uses

func (z *DropDatabaseRequest) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*DropDatabaseRequest) Sign Uses

func (r *DropDatabaseRequest) Sign(signer *asymmetric.PrivateKey) error

Sign the request.

func (*DropDatabaseRequest) Verify Uses

func (r *DropDatabaseRequest) Verify() error

Verify checks hash and signature in request header.

type DropDatabaseRequestHeader Uses

type DropDatabaseRequestHeader struct {
    DatabaseID proto.DatabaseID
}

DropDatabaseRequestHeader defines client drop database rpc request header.

func (*DropDatabaseRequestHeader) MarshalHash Uses

func (z *DropDatabaseRequestHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*DropDatabaseRequestHeader) Msgsize Uses

func (z *DropDatabaseRequestHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type DropDatabaseResponse Uses

type DropDatabaseResponse struct{}

DropDatabaseResponse defines client drop database rpc response entity.

func (DropDatabaseResponse) MarshalHash Uses

func (z DropDatabaseResponse) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (DropDatabaseResponse) Msgsize Uses

func (z DropDatabaseResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type FetchBlockByCountReq Uses

type FetchBlockByCountReq struct {
    proto.Envelope
    Count uint32
}

FetchBlockByCountReq define a request of the FetchBlockByCount RPC method.

type FetchBlockReq Uses

type FetchBlockReq struct {
    proto.Envelope
    Height uint32
}

FetchBlockReq defines a request of the FetchBlock RPC method.

type FetchBlockResp Uses

type FetchBlockResp struct {
    proto.Envelope
    Height uint32
    Count  uint32
    Block  *BPBlock
}

FetchBlockResp defines a response of the FetchBlock RPC method.

type FetchLastIrreversibleBlockReq Uses

type FetchLastIrreversibleBlockReq struct {
    proto.Envelope
    Address proto.AccountAddress
}

FetchLastIrreversibleBlockReq defines a request of the FetchLastIrreversibleBlock RPC method.

type FetchLastIrreversibleBlockResp Uses

type FetchLastIrreversibleBlockResp struct {
    proto.Envelope
    Count     uint32
    Height    uint32
    Block     *BPBlock
    SQLChains []*SQLChainProfile
}

FetchLastIrreversibleBlockResp defines a response of the FetchLastIrreversibleBlock RPC method.

type FetchTxBillingReq Uses

type FetchTxBillingReq struct {
    proto.Envelope
}

FetchTxBillingReq defines a request of the FetchTxBilling RPC method.

type FetchTxBillingResp Uses

type FetchTxBillingResp struct {
    proto.Envelope
}

FetchTxBillingResp defines a response of the FetchTxBilling RPC method.

type GetDatabaseRequest Uses

type GetDatabaseRequest struct {
    proto.Envelope
    Header SignedGetDatabaseRequestHeader
}

GetDatabaseRequest defines client get database rpc request entity.

func (*GetDatabaseRequest) MarshalHash Uses

func (z *GetDatabaseRequest) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*GetDatabaseRequest) Msgsize Uses

func (z *GetDatabaseRequest) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GetDatabaseRequest) Sign Uses

func (r *GetDatabaseRequest) Sign(signer *asymmetric.PrivateKey) error

Sign the request.

func (*GetDatabaseRequest) Verify Uses

func (r *GetDatabaseRequest) Verify() error

Verify checks hash and signature in request header.

type GetDatabaseRequestHeader Uses

type GetDatabaseRequestHeader struct {
    DatabaseID proto.DatabaseID
}

GetDatabaseRequestHeader defines client get database rpc request header entity.

func (*GetDatabaseRequestHeader) MarshalHash Uses

func (z *GetDatabaseRequestHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*GetDatabaseRequestHeader) Msgsize Uses

func (z *GetDatabaseRequestHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type GetDatabaseResponse Uses

type GetDatabaseResponse struct {
    proto.Envelope
    Header SignedGetDatabaseResponseHeader
}

GetDatabaseResponse defines client get database rpc response entity.

func (*GetDatabaseResponse) MarshalHash Uses

func (z *GetDatabaseResponse) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*GetDatabaseResponse) Msgsize Uses

func (z *GetDatabaseResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*GetDatabaseResponse) Sign Uses

func (r *GetDatabaseResponse) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*GetDatabaseResponse) Verify Uses

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

Verify checks hash and signature in response header.

type GetDatabaseResponseHeader Uses

type GetDatabaseResponseHeader struct {
    InstanceMeta ServiceInstance
}

GetDatabaseResponseHeader defines client get database rpc response header entity.

func (*GetDatabaseResponseHeader) MarshalHash Uses

func (z *GetDatabaseResponseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*GetDatabaseResponseHeader) Msgsize Uses

func (z *GetDatabaseResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type Header struct {
    Version     int32
    Producer    proto.NodeID
    GenesisHash hash.Hash
    ParentHash  hash.Hash
    MerkleRoot  hash.Hash
    Timestamp   time.Time
}

Header is a block header.

func (*Header) MarshalHash Uses

func (z *Header) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*Header) Msgsize Uses

func (z *Header) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type InitService Uses

type InitService struct {
    proto.Envelope
}

InitService defines worker service init request.

func (*InitService) MarshalHash Uses

func (z *InitService) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*InitService) Msgsize Uses

func (z *InitService) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type InitServiceResponse Uses

type InitServiceResponse struct {
    Header SignedInitServiceResponseHeader
}

InitServiceResponse defines worker service init response.

func (*InitServiceResponse) MarshalHash Uses

func (z *InitServiceResponse) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*InitServiceResponse) Msgsize Uses

func (z *InitServiceResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*InitServiceResponse) Sign Uses

func (rs *InitServiceResponse) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*InitServiceResponse) Verify Uses

func (rs *InitServiceResponse) Verify() error

Verify checks hash and signature in init service response header.

type InitServiceResponseHeader Uses

type InitServiceResponseHeader struct {
    Instances []ServiceInstance
}

InitServiceResponseHeader defines worker service init response header.

func (*InitServiceResponseHeader) MarshalHash Uses

func (z *InitServiceResponseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*InitServiceResponseHeader) Msgsize Uses

func (z *InitServiceResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type IssueKeys Uses

type IssueKeys struct {
    IssueKeysHeader
    interfaces.TransactionTypeMixin
    verifier.DefaultHashSignVerifierImpl
}

IssueKeys defines the database creation transaction.

func NewIssueKeys Uses

func NewIssueKeys(header *IssueKeysHeader) *IssueKeys

NewIssueKeys returns new instance.

func (*IssueKeys) GetAccountAddress Uses

func (ik *IssueKeys) GetAccountAddress() proto.AccountAddress

GetAccountAddress implements interfaces/Transaction.GetAccountAddress.

func (*IssueKeys) MarshalHash Uses

func (z *IssueKeys) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*IssueKeys) Msgsize Uses

func (z *IssueKeys) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*IssueKeys) Sign Uses

func (ik *IssueKeys) Sign(signer *asymmetric.PrivateKey) (err error)

Sign implements interfaces/Transaction.Sign.

func (*IssueKeys) Verify Uses

func (ik *IssueKeys) Verify() error

Verify implements interfaces/Transaction.Verify.

type IssueKeysHeader Uses

type IssueKeysHeader struct {
    TargetSQLChain proto.AccountAddress
    MinerKeys      []MinerKey
    Nonce          interfaces.AccountNonce
}

IssueKeysHeader defines an encryption key header.

func (*IssueKeysHeader) GetAccountNonce Uses

func (h *IssueKeysHeader) GetAccountNonce() interfaces.AccountNonce

GetAccountNonce implements interfaces/Transaction.GetAccountNonce.

func (*IssueKeysHeader) MarshalHash Uses

func (z *IssueKeysHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*IssueKeysHeader) Msgsize Uses

func (z *IssueKeysHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type MinerIncome Uses

type MinerIncome struct {
    Miner  proto.AccountAddress
    Income uint64
}

MinerIncome defines the income of miner.

func (*MinerIncome) MarshalHash Uses

func (z *MinerIncome) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*MinerIncome) Msgsize Uses

func (z *MinerIncome) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type MinerInfo Uses

type MinerInfo struct {
    Address        proto.AccountAddress
    NodeID         proto.NodeID
    Name           string
    PendingIncome  uint64
    ReceivedIncome uint64
    UserArrears    []*UserArrears
    Deposit        uint64
    Status         Status
    EncryptionKey  string
}

MinerInfo defines a miner.

func (*MinerInfo) MarshalHash Uses

func (z *MinerInfo) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*MinerInfo) Msgsize Uses

func (z *MinerInfo) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type MinerKey Uses

type MinerKey struct {
    Miner         proto.AccountAddress
    EncryptionKey string
}

MinerKey defines an encryption key associated with miner address.

func (*MinerKey) MarshalHash Uses

func (z *MinerKey) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*MinerKey) Msgsize Uses

func (z *MinerKey) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type NamedArg Uses

type NamedArg struct {
    Name  string
    Value interface{}
}

NamedArg defines the named argument structure for database.

func (NamedArg) MarshalHash Uses

func (z NamedArg) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (NamedArg) Msgsize Uses

func (z NamedArg) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type NextAccountNonceReq Uses

type NextAccountNonceReq struct {
    proto.Envelope
    Addr proto.AccountAddress
}

NextAccountNonceReq defines a request of the NextAccountNonce RPC method.

type NextAccountNonceResp Uses

type NextAccountNonceResp struct {
    proto.Envelope
    Addr  proto.AccountAddress
    Nonce interfaces.AccountNonce
}

NextAccountNonceResp defines a response of the NextAccountNonce RPC method.

type OrderMakerReq Uses

type OrderMakerReq struct {
    proto.Envelope
}

OrderMakerReq defines a request of the order maker in database market.

type OrderTakerReq Uses

type OrderTakerReq struct {
    proto.Envelope
    DBMeta ResourceMeta
}

OrderTakerReq defines a request of the order taker in database market.

type OrderTakerResp Uses

type OrderTakerResp struct {
    proto.Envelope
    // contains filtered or unexported fields
}

OrderTakerResp defines a response of the order taker in database market.

type PermStat Uses

type PermStat struct {
    Permission *UserPermission
    Status     Status
}

PermStat defines the permissions status structure.

type ProvideService Uses

type ProvideService struct {
    ProvideServiceHeader
    interfaces.TransactionTypeMixin
    verifier.DefaultHashSignVerifierImpl
}

ProvideService define the miner providing service transaction.

func NewProvideService Uses

func NewProvideService(h *ProvideServiceHeader) *ProvideService

NewProvideService returns new instance.

func (*ProvideService) GetAccountAddress Uses

func (ps *ProvideService) GetAccountAddress() proto.AccountAddress

GetAccountAddress implements interfaces/Transaction.GetAccountAddress.

func (*ProvideService) MarshalHash Uses

func (z *ProvideService) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*ProvideService) Msgsize Uses

func (z *ProvideService) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*ProvideService) Sign Uses

func (ps *ProvideService) Sign(signer *asymmetric.PrivateKey) (err error)

Sign implements interfaces/Transaction.Sign.

func (*ProvideService) Verify Uses

func (ps *ProvideService) Verify() error

Verify implements interfaces/Transaction.Verify.

type ProvideServiceHeader Uses

type ProvideServiceHeader struct {
    Space         uint64  // reserved storage space in bytes
    Memory        uint64  // reserved memory in bytes
    LoadAvgPerCPU float64 // max loadAvg15 per CPU
    TargetUser    []proto.AccountAddress
    GasPrice      uint64
    TokenType     TokenType
    NodeID        proto.NodeID
    Nonce         interfaces.AccountNonce
}

ProvideServiceHeader define the miner providing service transaction header.

func (*ProvideServiceHeader) GetAccountNonce Uses

func (h *ProvideServiceHeader) GetAccountNonce() interfaces.AccountNonce

GetAccountNonce implements interfaces/Transaction.GetAccountNonce.

func (*ProvideServiceHeader) MarshalHash Uses

func (z *ProvideServiceHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*ProvideServiceHeader) Msgsize Uses

func (z *ProvideServiceHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type ProviderProfile Uses

type ProviderProfile struct {
    Provider      proto.AccountAddress
    Space         uint64  // reserved storage space in bytes
    Memory        uint64  // reserved memory in bytes
    LoadAvgPerCPU float64 // max loadAvg15 per CPU
    TargetUser    []proto.AccountAddress
    Deposit       uint64 // default 10 Particle
    GasPrice      uint64
    TokenType     TokenType // default Particle
    NodeID        proto.NodeID
}

ProviderProfile defines a provider list.

func (*ProviderProfile) MarshalHash Uses

func (z *ProviderProfile) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*ProviderProfile) Msgsize Uses

func (z *ProviderProfile) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type Query Uses

type Query struct {
    Pattern string
    Args    []NamedArg
}

Query defines single query.

func (*Query) MarshalHash Uses

func (z *Query) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*Query) Msgsize Uses

func (z *Query) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type QueryAccountSQLChainProfilesReq Uses

type QueryAccountSQLChainProfilesReq struct {
    proto.Envelope
    Addr proto.AccountAddress
}

QueryAccountSQLChainProfilesReq defines a request of QueryAccountSQLChainProfiles RPC method.

type QueryAccountSQLChainProfilesResp Uses

type QueryAccountSQLChainProfilesResp struct {
    proto.Envelope
    Addr     proto.AccountAddress
    Profiles []*SQLChainProfile
}

QueryAccountSQLChainProfilesResp defines a response of QueryAccountSQLChainProfiles RPC method.

type QueryAccountTokenBalanceReq Uses

type QueryAccountTokenBalanceReq struct {
    proto.Envelope
    Addr      proto.AccountAddress
    TokenType TokenType
}

QueryAccountTokenBalanceReq defines a request of the QueryAccountTokenBalance RPC method.

type QueryAccountTokenBalanceResp Uses

type QueryAccountTokenBalanceResp struct {
    proto.Envelope
    Addr    proto.AccountAddress
    OK      bool
    Balance uint64
}

QueryAccountTokenBalanceResp defines a request of the QueryAccountTokenBalance RPC method.

type QueryAsTx Uses

type QueryAsTx struct {
    Request  *Request
    Response *SignedResponseHeader
}

QueryAsTx defines a tx struct which is combined with request and signed response header for block.

func (*QueryAsTx) MarshalHash Uses

func (z *QueryAsTx) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*QueryAsTx) Msgsize Uses

func (z *QueryAsTx) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type QueryKey Uses

type QueryKey struct {
    NodeID       proto.NodeID `json:"id"`
    ConnectionID uint64       `json:"cid"`
    SeqNo        uint64       `json:"seq"`
}

QueryKey defines an unique query key of a request.

func (*QueryKey) MarshalHash Uses

func (z *QueryKey) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*QueryKey) Msgsize Uses

func (z *QueryKey) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (QueryKey) String Uses

func (k QueryKey) String() string

String implements fmt.Stringer for logging purpose.

type QuerySQLChainProfileReq Uses

type QuerySQLChainProfileReq struct {
    proto.Envelope
    DBID proto.DatabaseID
}

QuerySQLChainProfileReq defines a request of the QuerySQLChainProfile RPC method.

type QuerySQLChainProfileResp Uses

type QuerySQLChainProfileResp struct {
    proto.Envelope
    Profile SQLChainProfile
}

QuerySQLChainProfileResp defines a response of the QuerySQLChainProfile RPC method.

type QueryTxStateReq Uses

type QueryTxStateReq struct {
    proto.Envelope
    Hash hash.Hash
}

QueryTxStateReq defines a request of the QueryTxState RPC method.

type QueryTxStateResp Uses

type QueryTxStateResp struct {
    proto.Envelope
    Hash  hash.Hash
    State pi.TransactionState
}

QueryTxStateResp defines a response of the QueryTxState RPC method.

type QueryType Uses

type QueryType int32

QueryType enumerates available query type, currently read/write.

const (
    // ReadQuery defines a read query type.
    ReadQuery QueryType = iota
    // WriteQuery defines a write query type.
    WriteQuery
    // NumberOfQueryType defines the number of query type.
    NumberOfQueryType
)

func (QueryType) MarshalHash Uses

func (z QueryType) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (QueryType) Msgsize Uses

func (z QueryType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (QueryType) String Uses

func (t QueryType) String() string

String implements fmt.Stringer for logging purpose.

type Range Uses

type Range struct {
    From, To uint32
}

Range defines a height range (from, to].

func (Range) MarshalHash Uses

func (z Range) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (Range) Msgsize Uses

func (z Range) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type Request Uses

type Request struct {
    proto.Envelope
    Header  SignedRequestHeader `json:"h"`
    Payload RequestPayload      `json:"p"`
    // contains filtered or unexported fields
}

Request defines a complete query request.

func (*Request) GetMarshalCache Uses

func (r *Request) GetMarshalCache() (buf []byte)

GetMarshalCache gets _marshalCache.

func (*Request) MarshalHash Uses

func (z *Request) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*Request) Msgsize Uses

func (z *Request) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Request) SetMarshalCache Uses

func (r *Request) SetMarshalCache(buf []byte)

SetMarshalCache sets _marshalCache.

func (*Request) Sign Uses

func (r *Request) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*Request) Verify Uses

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

Verify checks hash and signature in whole request.

type RequestHeader Uses

type RequestHeader struct {
    QueryType    QueryType        `json:"qt"`
    NodeID       proto.NodeID     `json:"id"`   // request node id
    DatabaseID   proto.DatabaseID `json:"dbid"` // request database id
    ConnectionID uint64           `json:"cid"`
    SeqNo        uint64           `json:"seq"`
    Timestamp    time.Time        `json:"t"`  // time in UTC zone
    BatchCount   uint64           `json:"bc"` // query count in this request
    QueriesHash  hash.Hash        `json:"qh"` // hash of query payload
}

RequestHeader defines a query request header.

func (*RequestHeader) GetQueryKey Uses

func (h *RequestHeader) GetQueryKey() QueryKey

GetQueryKey returns a unique query key of this request.

func (*RequestHeader) MarshalHash Uses

func (z *RequestHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*RequestHeader) Msgsize Uses

func (z *RequestHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type RequestPayload Uses

type RequestPayload struct {
    Queries []Query `json:"qs"`
}

RequestPayload defines a queries payload.

func (*RequestPayload) MarshalHash Uses

func (z *RequestPayload) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*RequestPayload) Msgsize Uses

func (z *RequestPayload) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type ResourceMeta Uses

type ResourceMeta struct {
    TargetMiners           []proto.AccountAddress // designated miners
    Node                   uint16                 // reserved node count
    Space                  uint64                 // reserved storage space in bytes
    Memory                 uint64                 // reserved memory in bytes
    LoadAvgPerCPU          float64                // max loadAvg15 per CPU
    EncryptionKey          string                 // encryption key for database instance
    UseEventualConsistency bool                   // use eventual consistency replication if enabled
    ConsistencyLevel       float64                // customized strong consistency level
    IsolationLevel         int                    // customized isolation level
}

ResourceMeta defines single database resource meta.

func (*ResourceMeta) MarshalHash Uses

func (z *ResourceMeta) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*ResourceMeta) Msgsize Uses

func (z *ResourceMeta) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type Response Uses

type Response struct {
    Header  SignedResponseHeader `json:"h"`
    Payload ResponsePayload      `json:"p"`
}

Response defines a complete query response.

func (*Response) BuildHash Uses

func (r *Response) BuildHash() (err error)

BuildHash computes the hash of the response.

func (*Response) Hash Uses

func (r *Response) Hash() hash.Hash

Hash returns the response header hash.

func (*Response) MarshalHash Uses

func (z *Response) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*Response) Msgsize Uses

func (z *Response) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Response) VerifyHash Uses

func (r *Response) VerifyHash() (err error)

VerifyHash verify the hash of the response.

type ResponseHeader Uses

type ResponseHeader struct {
    Request         RequestHeader        `json:"r"`
    RequestHash     hash.Hash            `json:"rh"`
    NodeID          proto.NodeID         `json:"id"` // response node id
    Timestamp       time.Time            `json:"t"`  // time in UTC zone
    RowCount        uint64               `json:"c"`  // response row count of payload
    LogOffset       uint64               `json:"o"`  // request log offset
    LastInsertID    int64                `json:"l"`  // insert insert id
    AffectedRows    int64                `json:"a"`  // affected rows
    PayloadHash     hash.Hash            `json:"dh"` // hash of query response payload
    ResponseAccount proto.AccountAddress `json:"aa"` // response account
}

ResponseHeader defines a query response header.

func (*ResponseHeader) GetRequestHash Uses

func (h *ResponseHeader) GetRequestHash() hash.Hash

GetRequestHash returns the request hash.

func (*ResponseHeader) GetRequestTimestamp Uses

func (h *ResponseHeader) GetRequestTimestamp() time.Time

GetRequestTimestamp returns the request timestamp.

func (*ResponseHeader) MarshalHash Uses

func (z *ResponseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*ResponseHeader) Msgsize Uses

func (z *ResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type ResponsePayload Uses

type ResponsePayload struct {
    Columns   []string      `json:"c"`
    DeclTypes []string      `json:"t"`
    Rows      []ResponseRow `json:"r"`
}

ResponsePayload defines column names and rows of query response.

func (*ResponsePayload) MarshalHash Uses

func (z *ResponsePayload) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*ResponsePayload) Msgsize Uses

func (z *ResponsePayload) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type ResponseRow Uses

type ResponseRow struct {
    Values []interface{}
}

ResponseRow defines single row of query response.

func (*ResponseRow) MarshalHash Uses

func (z *ResponseRow) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*ResponseRow) Msgsize Uses

func (z *ResponseRow) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type SQLChainProfile Uses

type SQLChainProfile struct {
    ID                proto.DatabaseID
    Address           proto.AccountAddress
    Period            uint64
    GasPrice          uint64
    LastUpdatedHeight uint32

    TokenType TokenType

    Owner proto.AccountAddress
    // first miner in the list is leader
    Miners []*MinerInfo

    Users []*SQLChainUser

    EncodedGenesis []byte

    Meta ResourceMeta // dumped from db creation tx
}

SQLChainProfile defines a SQLChainProfile related to an account.

func (*SQLChainProfile) MarshalHash Uses

func (z *SQLChainProfile) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SQLChainProfile) Msgsize Uses

func (z *SQLChainProfile) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type SQLChainRole Uses

type SQLChainRole byte

SQLChainRole defines roles of account in a SQLChain.

const (
    // Miner defines the miner role as a SQLChain user.
    Miner SQLChainRole = iota
    // Customer defines the customer role as a SQLChain user.
    Customer
    // NumberOfRoles defines the SQLChain roles number.
    NumberOfRoles
)

func (SQLChainRole) MarshalHash Uses

func (z SQLChainRole) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (SQLChainRole) Msgsize Uses

func (z SQLChainRole) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type SQLChainUser Uses

type SQLChainUser struct {
    Address        proto.AccountAddress
    Permission     *UserPermission
    AdvancePayment uint64
    Arrears        uint64
    Deposit        uint64
    Status         Status
}

SQLChainUser defines a SQLChain user.

func (*SQLChainUser) MarshalHash Uses

func (z *SQLChainUser) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SQLChainUser) Msgsize Uses

func (z *SQLChainUser) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type ServiceInstance Uses

type ServiceInstance struct {
    DatabaseID   proto.DatabaseID
    Peers        *proto.Peers
    ResourceMeta ResourceMeta
    GenesisBlock *Block
}

ServiceInstance defines single instance to be initialized.

func (*ServiceInstance) MarshalHash Uses

func (z *ServiceInstance) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*ServiceInstance) Msgsize Uses

func (z *ServiceInstance) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type SignedAckHeader Uses

type SignedAckHeader struct {
    AckHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedAckHeader defines client signed ack entity.

func (*SignedAckHeader) MarshalHash Uses

func (z *SignedAckHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedAckHeader) Msgsize Uses

func (z *SignedAckHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedAckHeader) Sign Uses

func (sh *SignedAckHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*SignedAckHeader) Verify Uses

func (sh *SignedAckHeader) Verify() (err error)

Verify checks hash and signature in ack header.

type SignedCreateDatabaseRequestHeader Uses

type SignedCreateDatabaseRequestHeader struct {
    CreateDatabaseRequestHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedCreateDatabaseRequestHeader defines signed client create database request header.

func (*SignedCreateDatabaseRequestHeader) MarshalHash Uses

func (z *SignedCreateDatabaseRequestHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedCreateDatabaseRequestHeader) Msgsize Uses

func (z *SignedCreateDatabaseRequestHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedCreateDatabaseRequestHeader) Sign Uses

func (sh *SignedCreateDatabaseRequestHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*SignedCreateDatabaseRequestHeader) Verify Uses

func (sh *SignedCreateDatabaseRequestHeader) Verify() (err error)

Verify checks hash and signature in create database request header.

type SignedCreateDatabaseResponseHeader Uses

type SignedCreateDatabaseResponseHeader struct {
    CreateDatabaseResponseHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedCreateDatabaseResponseHeader defines signed client create database response header.

func (*SignedCreateDatabaseResponseHeader) MarshalHash Uses

func (z *SignedCreateDatabaseResponseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedCreateDatabaseResponseHeader) Msgsize Uses

func (z *SignedCreateDatabaseResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedCreateDatabaseResponseHeader) Sign Uses

func (sh *SignedCreateDatabaseResponseHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the response.

func (*SignedCreateDatabaseResponseHeader) Verify Uses

func (sh *SignedCreateDatabaseResponseHeader) Verify() (err error)

Verify checks hash and signature in create database response header.

type SignedDropDatabaseRequestHeader Uses

type SignedDropDatabaseRequestHeader struct {
    DropDatabaseRequestHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedDropDatabaseRequestHeader defines signed client drop database rpc request header.

func (*SignedDropDatabaseRequestHeader) MarshalHash Uses

func (z *SignedDropDatabaseRequestHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedDropDatabaseRequestHeader) Msgsize Uses

func (z *SignedDropDatabaseRequestHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedDropDatabaseRequestHeader) Sign Uses

func (sh *SignedDropDatabaseRequestHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*SignedDropDatabaseRequestHeader) Verify Uses

func (sh *SignedDropDatabaseRequestHeader) Verify() (err error)

Verify checks hash and signature in request header.

type SignedGetDatabaseRequestHeader Uses

type SignedGetDatabaseRequestHeader struct {
    GetDatabaseRequestHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedGetDatabaseRequestHeader defines signed client get database rpc request header entity.

func (*SignedGetDatabaseRequestHeader) MarshalHash Uses

func (z *SignedGetDatabaseRequestHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedGetDatabaseRequestHeader) Msgsize Uses

func (z *SignedGetDatabaseRequestHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedGetDatabaseRequestHeader) Sign Uses

func (sh *SignedGetDatabaseRequestHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*SignedGetDatabaseRequestHeader) Verify Uses

func (sh *SignedGetDatabaseRequestHeader) Verify() (err error)

Verify checks hash and signature in request header.

type SignedGetDatabaseResponseHeader Uses

type SignedGetDatabaseResponseHeader struct {
    GetDatabaseResponseHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedGetDatabaseResponseHeader defines client get database rpc response header entity.

func (*SignedGetDatabaseResponseHeader) MarshalHash Uses

func (z *SignedGetDatabaseResponseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedGetDatabaseResponseHeader) Msgsize Uses

func (z *SignedGetDatabaseResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedGetDatabaseResponseHeader) Sign Uses

func (sh *SignedGetDatabaseResponseHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*SignedGetDatabaseResponseHeader) Verify Uses

func (sh *SignedGetDatabaseResponseHeader) Verify() (err error)

Verify checks hash and signature in response header.

type SignedHeader Uses

type SignedHeader struct {
    Header
    HSV verifier.DefaultHashSignVerifierImpl
}

SignedHeader is block header along with its producer signature.

func (*SignedHeader) ComputeHash Uses

func (s *SignedHeader) ComputeHash() error

ComputeHash computes the hash of the signed header.

func (*SignedHeader) MarshalHash Uses

func (z *SignedHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedHeader) Msgsize Uses

func (z *SignedHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedHeader) Sign Uses

func (s *SignedHeader) Sign(signer *ca.PrivateKey) error

Sign calls DefaultHashSignVerifierImpl to calculate header hash and sign it with signer.

func (*SignedHeader) Verify Uses

func (s *SignedHeader) Verify() error

Verify verifies the signature of the signed header.

func (*SignedHeader) VerifyHash Uses

func (s *SignedHeader) VerifyHash() error

VerifyHash verifies the hash of the signed header.

type SignedInitServiceResponseHeader Uses

type SignedInitServiceResponseHeader struct {
    InitServiceResponseHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedInitServiceResponseHeader defines signed worker service init response header.

func (*SignedInitServiceResponseHeader) MarshalHash Uses

func (z *SignedInitServiceResponseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedInitServiceResponseHeader) Msgsize Uses

func (z *SignedInitServiceResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedInitServiceResponseHeader) Sign Uses

func (sh *SignedInitServiceResponseHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*SignedInitServiceResponseHeader) Verify Uses

func (sh *SignedInitServiceResponseHeader) Verify() (err error)

Verify checks hash and signature in init service response header.

type SignedRequestHeader Uses

type SignedRequestHeader struct {
    RequestHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedRequestHeader defines a signed query request header.

func (*SignedRequestHeader) MarshalHash Uses

func (z *SignedRequestHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedRequestHeader) Msgsize Uses

func (z *SignedRequestHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedRequestHeader) Sign Uses

func (sh *SignedRequestHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*SignedRequestHeader) Verify Uses

func (sh *SignedRequestHeader) Verify() (err error)

Verify checks hash and signature in request header.

type SignedResponseHeader Uses

type SignedResponseHeader struct {
    ResponseHeader
    ResponseHash hash.Hash
}

SignedResponseHeader defines a signed query response header.

func (*SignedResponseHeader) BuildHash Uses

func (sh *SignedResponseHeader) BuildHash() (err error)

BuildHash computes the hash of the response header.

func (*SignedResponseHeader) Hash Uses

func (sh *SignedResponseHeader) Hash() hash.Hash

Hash returns the response header hash.

func (*SignedResponseHeader) MarshalHash Uses

func (z *SignedResponseHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedResponseHeader) Msgsize Uses

func (z *SignedResponseHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedResponseHeader) VerifyHash Uses

func (sh *SignedResponseHeader) VerifyHash() (err error)

VerifyHash verify the hash of the response.

type SignedUpdateServiceHeader Uses

type SignedUpdateServiceHeader struct {
    UpdateServiceHeader
    verifier.DefaultHashSignVerifierImpl
}

SignedUpdateServiceHeader defines signed service update header.

func (*SignedUpdateServiceHeader) MarshalHash Uses

func (z *SignedUpdateServiceHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*SignedUpdateServiceHeader) Msgsize Uses

func (z *SignedUpdateServiceHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*SignedUpdateServiceHeader) Sign Uses

func (sh *SignedUpdateServiceHeader) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*SignedUpdateServiceHeader) Verify Uses

func (sh *SignedUpdateServiceHeader) Verify() (err error)

Verify checks hash and signature in update service header.

type Status Uses

type Status int32

Status defines status of a SQLChain user/miner.

const (
    // UnknownStatus defines initial status.
    UnknownStatus Status = iota
    // Normal defines no bad thing happens.
    Normal
    // Reminder defines the user needs to increase advance payment.
    Reminder
    // Arrears defines the user is in arrears.
    Arrears
    // Arbitration defines the user/miner is in an arbitration.
    Arbitration
    // NumberOfStatus defines the number of status.
    NumberOfStatus
)

func (*Status) EnableQuery Uses

func (s *Status) EnableQuery() bool

EnableQuery indicates whether the account is permitted to query.

func (Status) MarshalHash Uses

func (z Status) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (Status) Msgsize Uses

func (z Status) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type SubReq Uses

type SubReq struct {
    proto.Envelope
    Topic    string
    Callback string
}

SubReq defines a request of the Sub RPC method.

type SubResp Uses

type SubResp struct {
    proto.Envelope
    Result string
}

SubResp defines a response of the Sub RPC method.

type TokenType Uses

type TokenType int32

TokenType defines token's type.

const (
    // Particle defines covenantsql's token
    Particle TokenType = iota
    // Wave defines covenantsql's token
    Wave
    // Ether defines Ethereum.
    Ether
    // EOS defines EOS.
    EOS
    // Bitcoin defines Bitcoin.
    Bitcoin
    // SupportTokenNumber defines the number of token covenantsql supports
    SupportTokenNumber
)

func FromString Uses

func FromString(t string) TokenType

FromString returns token's number.

func (*TokenType) Listed Uses

func (t *TokenType) Listed() bool

Listed returns if the token is listed in list.

func (TokenType) MarshalHash Uses

func (z TokenType) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (TokenType) Msgsize Uses

func (z TokenType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (TokenType) String Uses

func (t TokenType) String() string

String returns token's symbol.

type Transfer Uses

type Transfer struct {
    TransferHeader
    pi.TransactionTypeMixin
    verifier.DefaultHashSignVerifierImpl
}

Transfer defines the transfer transaction.

func NewTransfer Uses

func NewTransfer(header *TransferHeader) *Transfer

NewTransfer returns new instance.

func (*Transfer) GetAccountAddress Uses

func (t *Transfer) GetAccountAddress() proto.AccountAddress

GetAccountAddress implements interfaces/Transaction.GetAccountAddress.

func (*Transfer) GetAccountNonce Uses

func (t *Transfer) GetAccountNonce() pi.AccountNonce

GetAccountNonce implements interfaces/Transaction.GetAccountNonce.

func (*Transfer) MarshalHash Uses

func (z *Transfer) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*Transfer) Msgsize Uses

func (z *Transfer) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*Transfer) Sign Uses

func (t *Transfer) Sign(signer *asymmetric.PrivateKey) (err error)

Sign implements interfaces/Transaction.Sign.

func (*Transfer) Verify Uses

func (t *Transfer) Verify() (err error)

Verify implements interfaces/Transaction.Verify.

type TransferHeader Uses

type TransferHeader struct {
    Sender, Receiver proto.AccountAddress
    Nonce            pi.AccountNonce
    Amount           uint64
    TokenType        TokenType
}

TransferHeader defines the transfer transaction header.

func (*TransferHeader) MarshalHash Uses

func (z *TransferHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*TransferHeader) Msgsize Uses

func (z *TransferHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type UpdateBilling Uses

type UpdateBilling struct {
    UpdateBillingHeader
    pi.TransactionTypeMixin
    verifier.DefaultHashSignVerifierImpl
}

UpdateBilling defines the UpdateBilling transaction.

func NewUpdateBilling Uses

func NewUpdateBilling(header *UpdateBillingHeader) *UpdateBilling

NewUpdateBilling returns new instance.

func (*UpdateBilling) GetAccountAddress Uses

func (ub *UpdateBilling) GetAccountAddress() proto.AccountAddress

GetAccountAddress implements interfaces/Transaction.GetAccountAddress.

func (*UpdateBilling) GetAccountNonce Uses

func (ub *UpdateBilling) GetAccountNonce() pi.AccountNonce

GetAccountNonce implements interfaces/Transaction.GetAccountNonce.

func (*UpdateBilling) MarshalHash Uses

func (z *UpdateBilling) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UpdateBilling) Msgsize Uses

func (z *UpdateBilling) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UpdateBilling) Sign Uses

func (ub *UpdateBilling) Sign(signer *asymmetric.PrivateKey) (err error)

Sign implements interfaces/Transaction.Sign.

func (*UpdateBilling) Verify Uses

func (ub *UpdateBilling) Verify() (err error)

Verify implements interfaces/Transaction.Verify.

type UpdateBillingHeader Uses

type UpdateBillingHeader struct {
    Receiver proto.AccountAddress
    Nonce    pi.AccountNonce
    Users    []*UserCost
    Range    Range
    Version  int32 `hsp:"v,version"`
}

UpdateBillingHeader defines the UpdateBilling transaction header.

func (*UpdateBillingHeader) HSPCurrentVersion Uses

func (z *UpdateBillingHeader) HSPCurrentVersion() int

HSPCurrentVersion returns current struct version

func (*UpdateBillingHeader) HSPDefaultVersion Uses

func (z *UpdateBillingHeader) HSPDefaultVersion() int

HSPDefaultVersion returns default struct version

func (*UpdateBillingHeader) HSPMaxVersion Uses

func (z *UpdateBillingHeader) HSPMaxVersion() int

HSPMaxVersion returns max struct version

func (*UpdateBillingHeader) MarshalHash Uses

func (z *UpdateBillingHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UpdateBillingHeader) MarshalHash9ef447 Uses

func (z *UpdateBillingHeader) MarshalHash9ef447() (o []byte, err error)

MarshalHash9ef447 marshals for hash

func (*UpdateBillingHeader) MarshalHasholdver Uses

func (z *UpdateBillingHeader) MarshalHasholdver() (o []byte, err error)

MarshalHasholdver marshals for hash

func (*UpdateBillingHeader) Msgsize Uses

func (z *UpdateBillingHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UpdateBillingHeader) Msgsize9ef447 Uses

func (z *UpdateBillingHeader) Msgsize9ef447() (s int)

Msgsize9ef447 returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UpdateBillingHeader) Msgsizeoldver Uses

func (z *UpdateBillingHeader) Msgsizeoldver() (s int)

Msgsizeoldver returns an upper bound estimate of the number of bytes occupied by the serialized message

type UpdatePermission Uses

type UpdatePermission struct {
    UpdatePermissionHeader
    interfaces.TransactionTypeMixin
    verifier.DefaultHashSignVerifierImpl
}

UpdatePermission defines the updating sqlchain permission transaction.

func NewUpdatePermission Uses

func NewUpdatePermission(header *UpdatePermissionHeader) *UpdatePermission

NewUpdatePermission returns new instance.

func (*UpdatePermission) GetAccountAddress Uses

func (up *UpdatePermission) GetAccountAddress() proto.AccountAddress

GetAccountAddress implements interfaces/Transaction.GetAccountAddress.

func (*UpdatePermission) MarshalHash Uses

func (z *UpdatePermission) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UpdatePermission) Msgsize Uses

func (z *UpdatePermission) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UpdatePermission) Sign Uses

func (up *UpdatePermission) Sign(signer *asymmetric.PrivateKey) (err error)

Sign implements interfaces/Transaction.Sign.

func (*UpdatePermission) Verify Uses

func (up *UpdatePermission) Verify() error

Verify implements interfaces/Transaction.Verify.

type UpdatePermissionHeader Uses

type UpdatePermissionHeader struct {
    TargetSQLChain proto.AccountAddress
    TargetUser     proto.AccountAddress
    Permission     *UserPermission
    Nonce          interfaces.AccountNonce
}

UpdatePermissionHeader defines the updating sqlchain permission transaction header.

func (*UpdatePermissionHeader) GetAccountNonce Uses

func (u *UpdatePermissionHeader) GetAccountNonce() interfaces.AccountNonce

GetAccountNonce implements interfaces/Transaction.GetAccountNonce.

func (*UpdatePermissionHeader) MarshalHash Uses

func (z *UpdatePermissionHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UpdatePermissionHeader) Msgsize Uses

func (z *UpdatePermissionHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type UpdateService Uses

type UpdateService struct {
    proto.Envelope
    Header SignedUpdateServiceHeader
}

UpdateService defines service update type.

func (*UpdateService) MarshalHash Uses

func (z *UpdateService) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UpdateService) Msgsize Uses

func (z *UpdateService) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (*UpdateService) Sign Uses

func (s *UpdateService) Sign(signer *asymmetric.PrivateKey) (err error)

Sign the request.

func (*UpdateService) Verify Uses

func (s *UpdateService) Verify() error

Verify checks hash and signature in update service.

type UpdateServiceHeader Uses

type UpdateServiceHeader struct {
    Op       UpdateType
    Instance ServiceInstance
}

UpdateServiceHeader defines service update header.

func (*UpdateServiceHeader) MarshalHash Uses

func (z *UpdateServiceHeader) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UpdateServiceHeader) Msgsize Uses

func (z *UpdateServiceHeader) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type UpdateServiceResponse Uses

type UpdateServiceResponse struct{}

UpdateServiceResponse defines empty response entity.

func (UpdateServiceResponse) MarshalHash Uses

func (z UpdateServiceResponse) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (UpdateServiceResponse) Msgsize Uses

func (z UpdateServiceResponse) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type UpdateType Uses

type UpdateType int32

UpdateType defines service update type.

const (
    // CreateDB indicates create database operation.
    CreateDB UpdateType = iota
    // UpdateDB indicates database peers update operation.
    UpdateDB
    // DropDB indicates drop database operation.
    DropDB
)

func (UpdateType) MarshalHash Uses

func (z UpdateType) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (UpdateType) Msgsize Uses

func (z UpdateType) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type UserArrears Uses

type UserArrears struct {
    User    proto.AccountAddress
    Arrears uint64
}

UserArrears defines user's arrears.

func (*UserArrears) MarshalHash Uses

func (z *UserArrears) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UserArrears) Msgsize Uses

func (z *UserArrears) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type UserCost Uses

type UserCost struct {
    User   proto.AccountAddress
    Cost   uint64
    Miners []*MinerIncome
}

UserCost defines the cost of user.

func (*UserCost) MarshalHash Uses

func (z *UserCost) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UserCost) Msgsize Uses

func (z *UserCost) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type UserPermission Uses

type UserPermission struct {
    // User role to access database.
    Role UserPermissionRole
    // SQL pattern regulations for user queries
    // only a fully matched (case-sensitive) sql query is permitted to execute.
    Patterns []string
    // contains filtered or unexported fields
}

UserPermission defines permissions of a SQLChain user.

func UserPermissionFromRole Uses

func UserPermissionFromRole(role UserPermissionRole) *UserPermission

UserPermissionFromRole construct a new user permission instance from primitive user permission role enum.

func (*UserPermission) HasDisallowedQueryPatterns Uses

func (up *UserPermission) HasDisallowedQueryPatterns(queries []Query) (query string, status bool)

HasDisallowedQueryPatterns returns whether the queries are permitted.

func (*UserPermission) HasReadPermission Uses

func (up *UserPermission) HasReadPermission() bool

HasReadPermission returns true if user owns read permission.

func (*UserPermission) HasSuperPermission Uses

func (up *UserPermission) HasSuperPermission() bool

HasSuperPermission returns true if user owns super permission.

func (*UserPermission) HasWritePermission Uses

func (up *UserPermission) HasWritePermission() bool

HasWritePermission returns true if user owns write permission.

func (*UserPermission) IsValid Uses

func (up *UserPermission) IsValid() bool

IsValid returns whether the permission object is valid or not.

func (*UserPermission) MarshalHash Uses

func (z *UserPermission) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (*UserPermission) Msgsize Uses

func (z *UserPermission) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

type UserPermissionRole Uses

type UserPermissionRole int32

UserPermissionRole defines role of user permission including admin/write/read.

func (*UserPermissionRole) FromString Uses

func (r *UserPermissionRole) FromString(perm string)

FromString converts string to UserPermissionRole.

func (UserPermissionRole) MarshalHash Uses

func (z UserPermissionRole) MarshalHash() (o []byte, err error)

MarshalHash marshals for hash

func (UserPermissionRole) MarshalJSON Uses

func (r UserPermissionRole) MarshalJSON() ([]byte, error)

MarshalJSON implements the json.Marshaler interface.

func (UserPermissionRole) Msgsize Uses

func (z UserPermissionRole) Msgsize() (s int)

Msgsize returns an upper bound estimate of the number of bytes occupied by the serialized message

func (UserPermissionRole) String Uses

func (r UserPermissionRole) String() string

String implements the fmt.Stringer interface.

func (*UserPermissionRole) UnmarshalJSON Uses

func (r *UserPermissionRole) UnmarshalJSON(data []byte) (err error)

UnmarshalJSON implements the json.Unmarshler interface.

Package types imports 16 packages (graph) and is imported by 20 packages. Updated 2019-06-10. Refresh now. Tools for package owners.