constants

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2023 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Overview

Copyright IBM Corp. All Rights Reserved. SPDX-License-Identifier: Apache-2.0

Index

Constants

View Source
const (
	UserHeader      = "UserID"
	SignatureHeader = "Signature"
	TimeoutHeader   = "TxTimeout"

	UserEndpoint = "/user/"
	GetUser      = "/user/{userid}"
	PostUserTx   = "/user/tx"

	DataEndpoint = "/data/"
	// GetData Keys in URLs are expected to be encoded in base64 URL encoding without padding.
	GetData       = "/data/{dbname:" + `[0-9a-zA-Z_\-\.]+` + "}/{key}"
	GetDataRange  = "/data/{dbname:" + `[0-9a-zA-Z_\-\.]+` + "}"
	PostDataTx    = "/data/tx"
	PostDataQuery = "/data/{dbname:" + `[0-9a-zA-Z_\-\.]+` + "}/jsonquery"

	DBEndpoint  = "/db/"
	GetDBStatus = "/db/{dbname:" + `[0-9a-zA-Z_\-\.]+` + "}"
	GetDBIndex  = "/db/index/{dbname:" + `[0-9a-zA-Z_\-\.]+` + "}"
	PostDBTx    = "/db/tx"

	ConfigEndpoint     = "/config/"
	PostConfigTx       = "/config/tx"
	GetConfig          = "/config/tx"
	GetNodeConfigPath  = "/config/node"
	GetNodeConfig      = "/config/node/{nodeId}"
	GetLastConfigBlock = "/config/block/last"
	GetClusterStatus   = "/config/cluster"

	LedgerEndpoint     = "/ledger/"
	GetBlockHeader     = "/ledger/block/{blockId:[0-9]+}"
	GetLastBlockHeader = "/ledger/block/last"
	GetPath            = "/ledger/path"
	GetTxProofPrefix   = "/ledger/proof/tx"
	GetTxProof         = "/ledger/proof/tx/{blockId:[0-9]+}"
	GetDataProofPrefix = "/ledger/proof/data"
	// GetDataProof Keys in URLs are expected to be encoded in base64 URL encoding without padding.
	GetDataProof       = "/ledger/proof/data/{dbname:" + `[0-9a-zA-Z_\-\.]+` + "}/{key}"
	GetTxReceipt       = "/ledger/tx/receipt/{txId}"
	GetTxContentPrefix = "/ledger/tx/content"
	GetTxContent       = "/ledger/tx/content/{blockId:[0-9]+}"

	ProvenanceEndpoint = "/provenance/"
	// GetHistoricalData Keys in URLs are expected to be encoded in base64 URL encoding without padding.
	GetHistoricalData = "/provenance/data/history/{dbname}/{key}"
	// GetDataReaders Keys in URLs are expected to be encoded in base64 URL encoding without padding.
	GetDataReaders = "/provenance/data/readers/{dbname}/{key}"
	// GetDataWriters Keys in URLs are expected to be encoded in base64 URL encoding without padding.
	GetDataWriters          = "/provenance/data/writers/{dbname}/{key}"
	GetDataReadBy           = "/provenance/data/read/{userId}"
	GetDataWrittenBy        = "/provenance/data/written/{userId}"
	GetDataDeletedBy        = "/provenance/data/deleted/{userId}"
	GetTxIDsSubmittedBy     = "/provenance/data/tx/{userId}"
	GetMostRecentUserOrNode = "/provenance/{type:user|node}/{id}"
)
View Source
const (
	// Combination operators
	QueryOpAnd = "$and"
	QueryOpOr  = "$or"

	// Logical operators
	QueryOpEqual              = "$eq"
	QueryOpNotEqual           = "$neq"
	QueryOpGreaterThan        = "$gt"
	QueryOpLesserThan         = "$lt"
	QueryOpGreaterThanOrEqual = "$gte"
	QueryOpLesserThanOrEqual  = "$lte"

	// Top-level fields allowed in the query
	QueryFieldSelector = "selector"
)

Variables

This section is empty.

Functions

func SafeURLSegmentNZ

func SafeURLSegmentNZ(s string) error

SafeURLSegmentNZ checks that the string `s` is safe to use as a URL segment-nz. For example: `http://example.com:8080/tx/my-id`, for s="my-id". See: `https://www.ietf.org/rfc/rfc3986.txt`.

func URLDataProof

func URLDataProof(blockNum uint64, dbname, key string, deleted bool) string

URLDataProof returns URL for GET request to retrieve a data existence proof. Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetConfig

func URLForGetConfig() string

URLForGetConfig returns url for GET request to retrieve the cluster configuration

func URLForGetDBIndex added in v0.2.2

func URLForGetDBIndex(dbName string) string

URLForGetDBIndex returns url for GET request to retrieve the index definition of a given database

func URLForGetDBStatus

func URLForGetDBStatus(dbName string) string

URLForGetDBStatus returns url for GET request to find status of a given database

func URLForGetData

func URLForGetData(dbName, key string) string

URLForGetData returns url for GET request to retrieve value of the key present in the dbName. Keys in URLs are expected to be encoded in base64 URL encoding without padding.

func URLForGetDataDeletedBy

func URLForGetDataDeletedBy(userID string) string

URLForGetDataDeletedBy returns url for GET request to retrieve all data written by a given user

func URLForGetDataRange added in v0.2.4

func URLForGetDataRange(dbName, startKey, endKey string, limit uint64) string

URLForGetDataRange returns url for GET request to retrieve a range of values. Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetDataReadBy

func URLForGetDataReadBy(userID string) string

URLForGetDataReadBy returns url for GET request to retrieve all data read by a given user

func URLForGetDataReaders

func URLForGetDataReaders(dbName, key string) string

URLForGetDataReaders returns url for GET request to retrieve all users who have read a given key from a database. Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetDataWriters

func URLForGetDataWriters(dbName, key string) string

URLForGetDataWriters returns url for GET request to retrieve all users who have written a given key from a database. Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetDataWrittenBy

func URLForGetDataWrittenBy(userID string) string

URLForGetDataWrittenBy returns url for GET request to retrieve all data written by a given user

func URLForGetHistoricalData

func URLForGetHistoricalData(dbName, key string) string

URLForGetHistoricalData returns url for GET request to retrieve all values associated with a given key on a database. Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetHistoricalDataAt

func URLForGetHistoricalDataAt(dbName, key string, version *types.Version) string

URLForGetHistoricalDataAt returns url for GET request to retrieve a value at a particular version for a given key on a database. Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetHistoricalDataAtOrBelow

func URLForGetHistoricalDataAtOrBelow(dbName, key string, version *types.Version) string

URLForGetHistoricalDataAtOrBelow returns url for GET request to retrieve a most recent value at a particular version for a given key on a database Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetHistoricalDeletedData

func URLForGetHistoricalDeletedData(dbName, key string) string

URLForGetHistoricalDeletedData returns url for GET request to retrieve all deleted values associated with a given key on a database. Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetMostRecentNodeConfig

func URLForGetMostRecentNodeConfig(nodeID string, version *types.Version) string

func URLForGetMostRecentUserInfo

func URLForGetMostRecentUserInfo(userID string, version *types.Version) string

func URLForGetNextHistoricalData

func URLForGetNextHistoricalData(dbName, key string, version *types.Version) string

URLForGetNextHistoricalData returns url for GET request to retrieve next values for a given key on a database from a particular version Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetPreviousHistoricalData

func URLForGetPreviousHistoricalData(dbName, key string, version *types.Version) string

URLForGetPreviousHistoricalData returns url for GET request to retrieve previous values for a given key on a database from a particular version Keys in URLs are encoded in base64 URL encoding without padding.

func URLForGetTransactionReceipt

func URLForGetTransactionReceipt(txId string) string

func URLForGetTxIDsSubmittedBy

func URLForGetTxIDsSubmittedBy(userID string) string

URLForGetTxIDsSubmittedBy returns url for GET request to retrieve all txIDs submitted by a given user

func URLForGetUser

func URLForGetUser(userID string) string

URLForGetUser returns url for GET request to retrieve a user information

func URLForJSONQuery

func URLForJSONQuery(dbName string) string

URLForJSONQuery returns url for GET request to retrieve key-value pairs present in the dbName which are matching the given JSON query criteria

func URLForLastLedgerBlock

func URLForLastLedgerBlock() string

func URLForLedgerBlock

func URLForLedgerBlock(blockNum uint64, augmented bool) string

func URLForLedgerPath

func URLForLedgerPath(start, end uint64) string

func URLForNodeConfigPath

func URLForNodeConfigPath(nodeID string) string

func URLTxContent added in v0.2.8

func URLTxContent(blockNum uint64, txIdx uint64) string

func URLTxProof

func URLTxProof(blockNum uint64, txIdx uint64) string

Types

This section is empty.

Jump to

Keyboard shortcuts

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