verify

package
v0.0.0-...-6b52b4a Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var VerObj = NewVerifier(&Options{Often: 30})

Functions

This section is empty.

Types

type Healthy

type Healthy struct {
	Health bool  `json:"health"`
	Err    error `json:"err"`
}

type Options

type Options struct {
	Often time.Duration
}

type Order

type Order struct {
	PeerID    string    `json:"peer_id"`
	Port      int       `json:"port"`
	OrderID   string    `json:"order_id"`
	StartTime time.Time `json:"start_time"`
	EndTime   time.Time `json:"end_time"`
	Healthy   *Healthy  `json:"healthy"`
}

func (*Order) CheckHealthy

func (o *Order) CheckHealthy(ip string)

type OrderMysql

type OrderMysql struct {
	ID          uint   `gorm:"primarykey"`
	CreatedAt   int64  `gorm:"autoCreateTime"`
	UpdatedAt   int64  `gorm:"autoUpdateTime"`
	UserUUID    string `json:"user_uuid" gorm:"user_uuid"`
	Name        string `json:"name"`
	PeerID      string `json:"peer_id"`
	UUID        string `json:"uuid" gorm:"column:uuid"`
	Port        int    `json:"port"`
	Duration    uint   `json:"duration"` // 使用时间:小时
	Price       uint   `json:"price"`    // 金额
	ResourceCid string `json:"resource_cid"`
	ServerCid   string `json:"server_cid"`
	ClientCid   string `json:"client_cid"`
	Status      uint   `json:"status"` // 0:待支付,1:已支付,待回调,2:已完成
	NodeIP      string `json:"node_ip"`
}

func (OrderMysql) TableName

func (OrderMysql) TableName() string

type Provider

type Provider struct {
	PeerId string   `json:"peer_id"`
	Addr   string   `json:"addr"`
	Port   int      `json:"port"`
	IP     string   `json:"ip"`
	Loc    string   `json:"loc"`
	Colo   string   `json:"colo"`
	Price  uint     `json:"price"`
	Order  []*Order `json:"order"`
}

type Record

type Record struct {
	Total   uint64 `json:"total"`
	Success uint64 `json:"success"`
	Fail    uint64 `json:"fail"`
}

func (*Record) AddFail

func (r *Record) AddFail(num uint64)

func (*Record) AddSuccess

func (r *Record) AddSuccess(num uint64)

func (*Record) GetFail

func (r *Record) GetFail() uint64

func (*Record) GetSuccess

func (r *Record) GetSuccess() uint64

func (*Record) GetTotal

func (r *Record) GetTotal() uint64

type Verifier

type Verifier struct {
	Provider []*Provider

	Record map[string]*Record
	Health map[string]*Record
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewVerifier

func NewVerifier(opt *Options) (verifier *Verifier)

func (*Verifier) ProviderHealth

func (v *Verifier) ProviderHealth(orderID []string) (record map[string]*Record)

func (*Verifier) Run

func (v *Verifier) Run(ctx context.Context) error

func (*Verifier) Statistics

func (v *Verifier) Statistics()

func (*Verifier) SyncProviderAndOrder

func (v *Verifier) SyncProviderAndOrder()

Jump to

Keyboard shortcuts

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