couch

package
v0.0.0-...-f7d5a40 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DB name
	JOB_DB     = "hfrd_job"
	NETWORK_DB = "hfrd_network"

	SEPARATOR = "_"

	// Job DB Design Doc
	DESIGN_ID_JOB         = "_design/apiserver_v1"
	PENDING_JOBS_VIEW     = "pending_jobs" // For jobs with empty status and method of "POST" or "DELETE"
	PENDING_CREATE_BY_UID = "pending_create_by_uid"
	ALL_CERTS_JOB_VIEW    = "all_certs_jobs"

	// Network DB Design Doc
	DESIGN_ID_NETWORK = "_design/apiserver_v1"
	BY_SERVICEID      = "byServiceId"
	BY_USERID         = "byUserId"
)

Variables

This section is empty.

Functions

func DeleteCertsJobById

func DeleteCertsJobById(id string, ver string) (string, error)

func ForceSaveJob

func ForceSaveJob(job *Job) (string, error)

save doc again with rev conflict

func ForceSaveNetwork

func ForceSaveNetwork(network Network) (string, error)

func GetCertsJobByUserId

func GetCertsJobByUserId(uid string) (*kivik.Rows, error)

func GetNetworkByServiceId

func GetNetworkByServiceId(serviceId string) (*kivik.Rows, error)

func GetNetworkByUserId

func GetNetworkByUserId(uid string) (*kivik.Rows, error)

func GetPendingCertsByUserId

func GetPendingCertsByUserId(uid string) (*kivik.Rows, error)

func GetPendingCreateByUserId

func GetPendingCreateByUserId(uid string) (*kivik.Rows, error)

func GetPendingJobs

func GetPendingJobs() (*kivik.Rows, error)

return all network creation job with empty status

Types

type Job

type Job struct {
	ID         string `json:"_id"`
	Rev        string `json:"_rev,omitempty"`
	Name       string `json:"name"`
	QueueId    string `json:"queueId"`
	JobId      string `json:"jobId"`
	Status     string `json:"status"`
	ServiceId  string `json:"serviceId"` // only available for service deletion job
	Method     string `json:"method"`    // POST or DELETE
	User       string `json:"user"`
	Email      string `json:"email"`
	PlanName   string `json:"planName"`   // ONLY available for service creation job
	Env        string `json:"env"`        // ONLY available for service creation job
	Location   string `json:"location"`   // location id for IBP Enterprise Plan
	NumOfOrgs  int    `json:"numOfOrgs"`  // number of organizations
	NumOfPeers int    `json:"numOfPeers"` // number of peers
	LedgerType string `json:"ledgerType"` // ledger type
}

type Network

type Network struct {
	ID        string                 `json:"_id"`
	Rev       string                 `json:"_rev,omitempty"`
	NetworkId string                 `json:"networkId"`
	ServiceId string                 `json:"serviceId"`
	User      string                 `json:"user"`
	Email     string                 `json:"email"`
	Network   map[string]interface{} `json:"network"` // contain all Orgs' key and secret
	// Deleting: false, Deleted: false -> network is active from hfrd perspective
	// Deleting: true, Deleted: false -> deleting, job not completed yet
	// Deleting: false, Deleted: true -> blockchain network is completely deleted
	// Deleting: true, Deleted: true -> should NOT happen
	Deleting   bool   `json:"deleting"`
	Deleted    bool   `json:"deleted"`
	PlanName   string `json:"planName"`
	Env        string `json:"env"`
	CreatedAt  int64  `json:"createdAt"` // Unix timestamp in seconds
	JobId      string `json:"jobId"`
	JobName    string `json:"jobName"`
	Location   string `json:"location"`   // location id for IBP Enterprise Plan
	NumOfOrgs  int    `json:"numOfOrgs"`  // number of organizations
	NumOfPeers int    `json:"numOfPeers"` // number of peers
	LedgerType string `json:"ledgerType"` // ledger type

}

Jump to

Keyboard shortcuts

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