Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // CreditOperations tracks credit operations with labels for operation type, developer license, asset DID, and amount bucket CreditOperations = promauto.NewCounterVec( prometheus.CounterOpts{ Name: "credit_tracker_operations_total", Help: "Total number of credit operations performed by the credit tracker service", }, []string{"operation", "developer_license", "amount_bucket"}, ) // CreditBalance tracks the current credit balance CreditBalance = promauto.NewGaugeVec( prometheus.GaugeOpts{ Name: "credit_tracker_balance", Help: "Current credit balance tracked by the credit tracker service", }, []string{"developer_license"}, ) )
Functions ¶
Types ¶
type ContractProcessor ¶ added in v0.0.5
type CreditTrackerServer ¶ added in v0.0.5
type CreditTrackerServer struct {
grpc.UnimplementedCreditTrackerServer
// contains filtered or unexported fields
}
CreditTrackerServer represents the gRPC server
func NewServer ¶
func NewServer(repo Repository, contractProcessor ContractProcessor) *CreditTrackerServer
NewServer creates a new instance of the gRPC server
func (*CreditTrackerServer) DeductCredits ¶ added in v0.0.5
func (s *CreditTrackerServer) DeductCredits(ctx context.Context, req *grpc.CreditDeductRequest) (*grpc.CreditDeductResponse, error)
DeductCredits implements the gRPC service method
func (*CreditTrackerServer) RefundCredits ¶ added in v0.0.5
func (s *CreditTrackerServer) RefundCredits(ctx context.Context, req *grpc.RefundCreditsRequest) (*grpc.RefundCreditsResponse, error)
RefundCredits implements the gRPC service method
type Repository ¶ added in v0.0.5
type Repository interface {
DeductCredits(ctx context.Context, licenseID string, assetDID string, amount uint64, appName string, referenceID string) (*models.CreditOperation, error)
RefundCredits(ctx context.Context, appName string, referenceID string) (*models.CreditOperation, error)
GetBalance(ctx context.Context, licenseID, assetDID string) (int64, error)
}
Click to show internal directories.
Click to hide internal directories.