balance

package
v0.0.0-...-c47db54 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSealos

func InitSealos(jwtKey string, accountURL string) error

FIXME: 如果获取余额能成功,但是消费永远失败,需要加一个失败次数限制,如果失败次数超过一定阈值,暂停服务

Types

type GroupBalance

type GroupBalance interface {
	GetGroupRemainBalance(ctx context.Context, group string) (float64, PostGroupConsumer, error)
}

type MockGroupBalance

type MockGroupBalance struct{}

func NewMockGroupBalance

func NewMockGroupBalance() *MockGroupBalance

func (*MockGroupBalance) GetBalance

func (q *MockGroupBalance) GetBalance(_ context.Context) (float64, error)

func (*MockGroupBalance) GetGroupRemainBalance

func (q *MockGroupBalance) GetGroupRemainBalance(_ context.Context, _ string) (float64, PostGroupConsumer, error)

func (*MockGroupBalance) PostGroupConsume

func (q *MockGroupBalance) PostGroupConsume(_ context.Context, _ string, usage float64) (float64, error)

type PostGroupConsumer

type PostGroupConsumer interface {
	PostGroupConsume(ctx context.Context, tokenName string, usage float64) (float64, error)
	GetBalance(ctx context.Context) (float64, error)
}

type Sealos

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

func NewSealos

func NewSealos(accountURL string) *Sealos

func (*Sealos) GetGroupRemainBalance

func (s *Sealos) GetGroupRemainBalance(ctx context.Context, group string) (float64, PostGroupConsumer, error)

type SealosPostGroupConsumer

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

func (*SealosPostGroupConsumer) GetBalance

func (s *SealosPostGroupConsumer) GetBalance(_ context.Context) (float64, error)

func (*SealosPostGroupConsumer) PostGroupConsume

func (s *SealosPostGroupConsumer) PostGroupConsume(ctx context.Context, tokenName string, usage float64) (float64, error)

Jump to

Keyboard shortcuts

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