Documentation ¶
Index ¶
- Variables
- type Config
- type Customer
- type FreeQuotaInterval
- type Period
- type PriceType
- type Product
- type Service
- func (s *Service) CheckHealth(_ context.Context, _ *pb.CheckHealthRequest) (*pb.CheckHealthResponse, error)
- func (s *Service) CreateCustomer(ctx context.Context, req *pb.CreateCustomerRequest) (*pb.CreateCustomerResponse, error)
- func (s *Service) DeleteCustomer(ctx context.Context, req *pb.DeleteCustomerRequest) (*pb.DeleteCustomerResponse, error)
- func (s *Service) GetCustomer(ctx context.Context, req *pb.GetCustomerRequest) (*pb.GetCustomerResponse, error)
- func (s *Service) GetCustomerSession(ctx context.Context, req *pb.GetCustomerSessionRequest) (*pb.GetCustomerSessionResponse, error)
- func (s *Service) GetCustomerUsage(ctx context.Context, req *pb.GetCustomerUsageRequest) (*pb.GetCustomerUsageResponse, error)
- func (s *Service) IncCustomerUsage(ctx context.Context, req *pb.IncCustomerUsageRequest) (*pb.IncCustomerUsageResponse, error)
- func (s *Service) ListDependentCustomers(ctx context.Context, req *pb.ListDependentCustomersRequest) (*pb.ListDependentCustomersResponse, error)
- func (s *Service) RecreateCustomerSubscription(ctx context.Context, req *pb.RecreateCustomerSubscriptionRequest) (*pb.RecreateCustomerSubscriptionResponse, error)
- func (s *Service) ReportCustomerUsage(ctx context.Context, req *pb.ReportCustomerUsageRequest) (*pb.ReportCustomerUsageResponse, error)
- func (s *Service) Start() error
- func (s *Service) Stop(force bool) error
- func (s *Service) UpdateCustomer(ctx context.Context, req *pb.UpdateCustomerRequest) (*pb.UpdateCustomerResponse, error)
- func (s *Service) UpdateCustomerSubscription(ctx context.Context, req *pb.UpdateCustomerSubscriptionRequest) (*pb.UpdateCustomerSubscriptionResponse, error)
- type Usage
Constants ¶
This section is empty.
Variables ¶
View Source
var Products = []Product{ { Key: "stored_data", Name: "Stored data", Price: 0.03 / gib, PriceType: PriceTypeTemporal, FreeQuotaSize: 5 * gib, FreeQuotaGracePeriodSize: 1000 * gib, FreeQuotaInterval: FreeQuotaMonthly, Units: "bytes", UnitSize: 8 * mib, }, { Key: "network_egress", Name: "Network egress", Price: 0.1 / gib, PriceType: PriceTypeIncremental, FreeQuotaSize: 10 * gib, FreeQuotaGracePeriodSize: 1000 * gib, FreeQuotaInterval: FreeQuotaMonthly, Units: "bytes", UnitSize: 8 * mib, }, { Key: "instance_reads", Name: "ThreadDB reads", Price: 0.1 / 100000, PriceType: PriceTypeIncremental, FreeQuotaSize: 50000, FreeQuotaGracePeriodSize: 1000000, FreeQuotaInterval: FreeQuotaDaily, UnitSize: 100, }, { Key: "instance_writes", Name: "ThreadDB writes", Price: 0.2 / 100000, PriceType: PriceTypeIncremental, FreeQuotaSize: 20000, FreeQuotaGracePeriodSize: 1000000, FreeQuotaInterval: FreeQuotaDaily, UnitSize: 100, }, }
Functions ¶
This section is empty.
Types ¶
type Customer ¶
type Customer struct { Key string `bson:"_id"` CustomerID string `bson:"customer_id"` ParentKey string `bson:"parent_key"` Email string `bson:"email"` AccountType mdb.AccountType `bson:"account_type"` SubscriptionStatus string `bson:"subscription_status"` Balance int64 `bson:"balance"` Billable bool `bson:"billable"` Delinquent bool `bson:"delinquent"` CreatedAt int64 `bson:"created_at"` GracePeriodStart int64 `bson:"grace_period_start"` InvoicePeriod Period `bson:"invoice_period"` DailyUsage map[string]Usage `bson:"daily_usage"` }
func (*Customer) AccountStatus ¶
type FreeQuotaInterval ¶
type FreeQuotaInterval string
const ( FreeQuotaMonthly FreeQuotaInterval = "monthly" FreeQuotaDaily = "daily" )
type PriceType ¶
type PriceType string
const ( PriceTypeTemporal PriceType = "temporal" PriceTypeIncremental = "incremental" )
type Product ¶
type Product struct { Key string `bson:"_id"` Name string `bson:"name"` Price float64 `bson:"price"` PriceType PriceType `bson:"price_type"` FreeQuotaSize int64 `bson:"free_quota_size"` FreeQuotaGracePeriodSize int64 `bson:"free_quota_grace_period_size"` FreeQuotaInterval FreeQuotaInterval `bson:"free_quota_interval"` Units string `bson:"units"` UnitSize int64 `bson:"unit_size"` FreePriceID string `bson:"free_price_id"` PaidPriceID string `bson:"paid_price_id"` }
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) CheckHealth ¶
func (s *Service) CheckHealth(_ context.Context, _ *pb.CheckHealthRequest) (*pb.CheckHealthResponse, error)
func (*Service) CreateCustomer ¶
func (s *Service) CreateCustomer(ctx context.Context, req *pb.CreateCustomerRequest) ( *pb.CreateCustomerResponse, error)
func (*Service) DeleteCustomer ¶
func (s *Service) DeleteCustomer(ctx context.Context, req *pb.DeleteCustomerRequest) ( *pb.DeleteCustomerResponse, error)
func (*Service) GetCustomer ¶
func (s *Service) GetCustomer(ctx context.Context, req *pb.GetCustomerRequest) ( *pb.GetCustomerResponse, error)
func (*Service) GetCustomerSession ¶
func (s *Service) GetCustomerSession(ctx context.Context, req *pb.GetCustomerSessionRequest) ( *pb.GetCustomerSessionResponse, error)
func (*Service) GetCustomerUsage ¶ added in v2.1.5
func (s *Service) GetCustomerUsage( ctx context.Context, req *pb.GetCustomerUsageRequest, ) (*pb.GetCustomerUsageResponse, error)
func (*Service) IncCustomerUsage ¶
func (s *Service) IncCustomerUsage( ctx context.Context, req *pb.IncCustomerUsageRequest, ) (*pb.IncCustomerUsageResponse, error)
func (*Service) ListDependentCustomers ¶
func (s *Service) ListDependentCustomers(ctx context.Context, req *pb.ListDependentCustomersRequest) ( *pb.ListDependentCustomersResponse, error)
func (*Service) RecreateCustomerSubscription ¶
func (s *Service) RecreateCustomerSubscription(ctx context.Context, req *pb.RecreateCustomerSubscriptionRequest) ( *pb.RecreateCustomerSubscriptionResponse, error)
func (*Service) ReportCustomerUsage ¶ added in v2.1.5
func (s *Service) ReportCustomerUsage( ctx context.Context, req *pb.ReportCustomerUsageRequest, ) (*pb.ReportCustomerUsageResponse, error)
func (*Service) UpdateCustomer ¶
func (s *Service) UpdateCustomer(ctx context.Context, req *pb.UpdateCustomerRequest) ( *pb.UpdateCustomerResponse, error)
func (*Service) UpdateCustomerSubscription ¶
func (s *Service) UpdateCustomerSubscription(ctx context.Context, req *pb.UpdateCustomerSubscriptionRequest) ( *pb.UpdateCustomerSubscriptionResponse, error)
Click to show internal directories.
Click to hide internal directories.