Documentation
¶
Index ¶
- Constants
- func BytesToGBRoundUp(value int64) int64
- func IsExceeded(err error) bool
- func KnownDimension(d Dimension) bool
- func RunMigrations(ctx context.Context, pool *pgxpool.Pool, logger Logger) error
- type DB
- type Decision
- type Dimension
- type ExceededError
- type Limit
- type Logger
- type Repository
- func (r *Repository) AdditionalStorageUsageGB(ctx context.Context, teamID string, dimension Dimension, subjectType string, ...) (int64, error)
- func (r *Repository) CheckAdditionalStorageUsageGB(ctx context.Context, teamID string, dimension Dimension, subjectType string, ...) (Decision, error)
- func (r *Repository) CheckProjectedStorageUsageGB(ctx context.Context, teamID string, dimension Dimension, ...) (Decision, error)
- func (r *Repository) CurrentUsage(ctx context.Context, teamID string, dimension Dimension) (int64, error)
- func (r *Repository) DeleteLimit(ctx context.Context, teamID string, dimension Dimension) error
- func (r *Repository) GetLimit(ctx context.Context, teamID string, dimension Dimension) (*Limit, error)
- func (r *Repository) ProjectedStorageUsageGB(ctx context.Context, teamID string, dimension Dimension, ...) (int64, error)
- func (r *Repository) PutLimit(ctx context.Context, limit *Limit) error
Constants ¶
View Source
const BytesPerGB int64 = 1_000_000_000
View Source
const SchemaName = "quota"
Variables ¶
This section is empty.
Functions ¶
func BytesToGBRoundUp ¶
func IsExceeded ¶
func KnownDimension ¶
Types ¶
type Decision ¶
type Decision struct {
Allowed bool `json:"allowed"`
TeamID string `json:"team_id"`
Dimension Dimension `json:"dimension"`
LimitValue int64 `json:"limit_value"`
Current int64 `json:"current"`
Requested int64 `json:"requested"`
}
type Dimension ¶
type Dimension string
const ( DimensionActiveSandboxes Dimension = "active_sandboxes" DimensionCPU Dimension = "cpu_millicpu" DimensionMemory Dimension = "memory_mib" DimensionVolumeStorageGB Dimension = "volume_storage_gb" DimensionSnapshotGB Dimension = "snapshot_storage_gb" DimensionEgress Dimension = "egress" DimensionIngress Dimension = "ingress" )
type ExceededError ¶
type ExceededError struct {
Decision Decision
}
func (*ExceededError) Error ¶
func (e *ExceededError) Error() string
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
func NewRepository ¶
func NewRepository(pool *pgxpool.Pool) *Repository
func NewRepositoryWithDB ¶
func NewRepositoryWithDB(db DB) *Repository
func (*Repository) AdditionalStorageUsageGB ¶
func (*Repository) CheckAdditionalStorageUsageGB ¶
func (*Repository) CheckProjectedStorageUsageGB ¶
func (*Repository) CurrentUsage ¶
func (*Repository) DeleteLimit ¶
func (*Repository) ProjectedStorageUsageGB ¶
Click to show internal directories.
Click to hide internal directories.