Documentation
¶
Index ¶
- Constants
- func GetDB() (*sql.DB, error)
- func InitDB(ctx context.Context, log *logging.Logger) error
- type HourlyUsageEntry
- type TrackingMCPEntry
- type UsageTracker
- func (u *UsageTracker) Close() error
- func (u *UsageTracker) CreateOrIgnoreEvent(ctx context.Context, project string, workspace string, mcp_name string) error
- func (u *UsageTracker) CreationEvent(ctx context.Context, project string, workspace string, mcp_name string) error
- func (u *UsageTracker) DeletionEvent(ctx context.Context, project string, workspace string, mcp_name string) error
- func (u *UsageTracker) ScheduledEvent(ctx context.Context) error
- func (u *UsageTracker) WriteToResource(ctx context.Context, client client.Client) error
Constants ¶
View Source
const DAY = 24 * time.Hour
Variables ¶
This section is empty.
Functions ¶
Types ¶
type HourlyUsageEntry ¶
type HourlyUsageEntry struct { Project string Workspace string Name string Timestamp time.Time Minutes int }
func (*HourlyUsageEntry) ObjectKey ¶
func (h *HourlyUsageEntry) ObjectKey() client.ObjectKey
func (*HourlyUsageEntry) ResourceName ¶
func (h *HourlyUsageEntry) ResourceName() string
type TrackingMCPEntry ¶
type UsageTracker ¶
type UsageTracker struct {
// contains filtered or unexported fields
}
func NewUsageTracker ¶
func NewUsageTracker(log *logging.Logger) (*UsageTracker, error)
func (*UsageTracker) Close ¶
func (u *UsageTracker) Close() error
func (*UsageTracker) CreateOrIgnoreEvent ¶
func (u *UsageTracker) CreateOrIgnoreEvent(ctx context.Context, project string, workspace string, mcp_name string) error
This method creates a tracking entry in the DB, if it not already exists updated a tracking entry in the DB, if it is there, but has a deleted_at entry does nothing to the DB, if it is already there
func (*UsageTracker) CreationEvent ¶
func (*UsageTracker) DeletionEvent ¶
func (*UsageTracker) ScheduledEvent ¶
func (u *UsageTracker) ScheduledEvent(ctx context.Context) error
func (*UsageTracker) WriteToResource ¶
Click to show internal directories.
Click to hide internal directories.