bolt

package
v3.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AGREEMENTS = "agreements" // The bolt DB bucket name for agreement objects.
View Source
const BOLTDB_DATABASE_NAME = "agreementbot.db"

Constants used in this package.

View Source
const WORKLOAD_USAGE = "workload_usage"

Variables

This section is empty.

Functions

This section is empty.

Types

type AgbotBoltDB

type AgbotBoltDB struct {
	// contains filtered or unexported fields
}

This is the object that represents the handle to the bolt func (db *AgbotBoltDB)

func (*AgbotBoltDB) AgreementAttempt

func (db *AgbotBoltDB) AgreementAttempt(agreementid string, org string, deviceid string, policyName string, bcType string, bcName string, bcOrg string, agreementProto string, pattern string, serviceId []string, nhPolicy policy.NodeHealth) error

func (*AgbotBoltDB) AgreementBlockchainUpdate

func (db *AgbotBoltDB) AgreementBlockchainUpdate(agreementId string, consumerSig string, hash string, counterParty string, signature string, protocol string) (*persistence.Agreement, error)

func (*AgbotBoltDB) AgreementBlockchainUpdateAck

func (db *AgbotBoltDB) AgreementBlockchainUpdateAck(agreementId string, protocol string) (*persistence.Agreement, error)

func (*AgbotBoltDB) AgreementFinalized

func (db *AgbotBoltDB) AgreementFinalized(agreementId string, protocol string) (*persistence.Agreement, error)

func (*AgbotBoltDB) AgreementMade

func (db *AgbotBoltDB) AgreementMade(agreementId string, counterParty string, signature string, protocol string, hapartners []string, bcType string, bcName string, bcOrg string) (*persistence.Agreement, error)

func (*AgbotBoltDB) AgreementTimedout

func (db *AgbotBoltDB) AgreementTimedout(agreementid string, protocol string) (*persistence.Agreement, error)

func (*AgbotBoltDB) AgreementUpdate

func (db *AgbotBoltDB) AgreementUpdate(agreementid string, proposal string, policy string, dvPolicy policy.DataVerification, defaultCheckRate uint64, hash string, sig string, protocol string, agreementProtoVersion int) (*persistence.Agreement, error)

func (*AgbotBoltDB) ArchiveAgreement

func (db *AgbotBoltDB) ArchiveAgreement(agreementid string, protocol string, reason uint, desc string) (*persistence.Agreement, error)

func (*AgbotBoltDB) ClaimPartition

func (db *AgbotBoltDB) ClaimPartition(timeout uint64) (string, error)

func (*AgbotBoltDB) Close

func (db *AgbotBoltDB) Close()

func (*AgbotBoltDB) DataNotVerified

func (db *AgbotBoltDB) DataNotVerified(agreementid string, protocol string) (*persistence.Agreement, error)

func (*AgbotBoltDB) DataNotification

func (db *AgbotBoltDB) DataNotification(agreementid string, protocol string) (*persistence.Agreement, error)

func (*AgbotBoltDB) DataVerified

func (db *AgbotBoltDB) DataVerified(agreementid string, protocol string) (*persistence.Agreement, error)

func (*AgbotBoltDB) DeleteAgreement

func (db *AgbotBoltDB) DeleteAgreement(pk string, protocol string) error

func (*AgbotBoltDB) DeleteWorkloadUsage

func (db *AgbotBoltDB) DeleteWorkloadUsage(deviceid string, policyName string) error

func (*AgbotBoltDB) DisableRollbackChecking

func (db *AgbotBoltDB) DisableRollbackChecking(deviceid string, policyName string) (*persistence.WorkloadUsage, error)

func (*AgbotBoltDB) FindAgreements

func (db *AgbotBoltDB) FindAgreements(filters []persistence.AFilter, protocol string) ([]persistence.Agreement, error)

func (*AgbotBoltDB) FindPartitions

func (db *AgbotBoltDB) FindPartitions() ([]string, error)

Functions related to partitions in the bolt database. It does not use partitions, or rather has only 1 global partition.

func (*AgbotBoltDB) FindSingleAgreementByAgreementId

func (db *AgbotBoltDB) FindSingleAgreementByAgreementId(agreementid string, protocol string, filters []persistence.AFilter) (*persistence.Agreement, error)

no error on not found, only nil

func (*AgbotBoltDB) FindSingleAgreementByAgreementIdAllProtocols

func (db *AgbotBoltDB) FindSingleAgreementByAgreementIdAllProtocols(agreementid string, protocols []string, filters []persistence.AFilter) (*persistence.Agreement, error)

no error on not found, only nil

func (*AgbotBoltDB) FindSingleWorkloadUsageByDeviceAndPolicyName

func (db *AgbotBoltDB) FindSingleWorkloadUsageByDeviceAndPolicyName(deviceid string, policyName string) (*persistence.WorkloadUsage, error)

func (*AgbotBoltDB) FindWorkloadUsages

func (db *AgbotBoltDB) FindWorkloadUsages(filters []persistence.WUFilter) ([]persistence.WorkloadUsage, error)

func (*AgbotBoltDB) GetAgreementCount

func (db *AgbotBoltDB) GetAgreementCount(partition string) (int64, int64, error)

func (*AgbotBoltDB) GetPartitionOwner

func (db *AgbotBoltDB) GetPartitionOwner(id string) (string, error)

func (*AgbotBoltDB) GetWorkloadUsagesCount

func (db *AgbotBoltDB) GetWorkloadUsagesCount(partition string) (int64, error)

func (*AgbotBoltDB) HeartbeatPartition

func (db *AgbotBoltDB) HeartbeatPartition() error

func (*AgbotBoltDB) Initialize

func (db *AgbotBoltDB) Initialize(cfg *config.HorizonConfig) error

Setup everything bolt DB needs to be able to run an agbot. Since bolt is a simple document based database, all we need to setup is database file itself. There are no tables or indexes to create for bolt DB.

func (*AgbotBoltDB) MeteringNotification

func (db *AgbotBoltDB) MeteringNotification(agreementid string, protocol string, mn string) (*persistence.Agreement, error)

func (*AgbotBoltDB) MovePartition

func (db *AgbotBoltDB) MovePartition(timeout uint64) error

func (*AgbotBoltDB) NewWorkloadUsage

func (db *AgbotBoltDB) NewWorkloadUsage(deviceId string, hapartners []string, policy string, policyName string, priority int, retryDurationS int, verifiedDurationS int, reqsNotMet bool, agid string) error

func (*AgbotBoltDB) QuiescePartition

func (db *AgbotBoltDB) QuiescePartition() error

func (*AgbotBoltDB) SingleAgreementUpdate

func (db *AgbotBoltDB) SingleAgreementUpdate(agreementid string, protocol string, fn func(persistence.Agreement) *persistence.Agreement) (*persistence.Agreement, error)

func (*AgbotBoltDB) SingleWorkloadUsageUpdate

func (db *AgbotBoltDB) SingleWorkloadUsageUpdate(deviceid string, policyName string, fn func(persistence.WorkloadUsage) *persistence.WorkloadUsage) (*persistence.WorkloadUsage, error)

func (*AgbotBoltDB) String

func (db *AgbotBoltDB) String() string

func (*AgbotBoltDB) UpdatePendingUpgrade

func (db *AgbotBoltDB) UpdatePendingUpgrade(deviceid string, policyName string) (*persistence.WorkloadUsage, error)

func (*AgbotBoltDB) UpdatePolicy

func (db *AgbotBoltDB) UpdatePolicy(deviceid string, policyName string, pol string) (*persistence.WorkloadUsage, error)

func (*AgbotBoltDB) UpdatePriority

func (db *AgbotBoltDB) UpdatePriority(deviceid string, policyName string, priority int, retryDurationS int, verifiedDurationS int, agid string) (*persistence.WorkloadUsage, error)

func (*AgbotBoltDB) UpdateRetryCount

func (db *AgbotBoltDB) UpdateRetryCount(deviceid string, policyName string, retryCount int, agid string) (*persistence.WorkloadUsage, error)

func (*AgbotBoltDB) UpdateWUAgreementId

func (db *AgbotBoltDB) UpdateWUAgreementId(deviceid string, policyName string, agid string, protocol string) (*persistence.WorkloadUsage, error)

func (*AgbotBoltDB) WUPersistNew

func (db *AgbotBoltDB) WUPersistNew(bucket string, record *persistence.WorkloadUsage) error

This function allocates the record's primary key from the DB's internal sequence counter. The record being created is updated with this key right before it is written. This function assumes that duplicate record checks have already occurred before it is called.

Jump to

Keyboard shortcuts

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