From c91fc8ac9e21ec670506ff983ef4a1ae6e940df3 Mon Sep 17 00:00:00 2001 From: Michael Quigley Date: Thu, 23 Mar 2023 17:04:10 -0400 Subject: [PATCH] handlers for account, environment, and strategy (#276) --- controller/limits/config.go | 2 +- controller/limits/model.go | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 controller/limits/model.go diff --git a/controller/limits/config.go b/controller/limits/config.go index 4e6fbbe1..86fea17e 100644 --- a/controller/limits/config.go +++ b/controller/limits/config.go @@ -32,7 +32,7 @@ type Bandwidth struct { func DefaultBandwidthPerPeriod() *BandwidthPerPeriod { return &BandwidthPerPeriod{ - Period: 15 * (24 * time.Hour), + Period: 24 * time.Hour, Warning: &Bandwidth{ Rx: Unlimited, Tx: Unlimited, diff --git a/controller/limits/model.go b/controller/limits/model.go new file mode 100644 index 00000000..2753da32 --- /dev/null +++ b/controller/limits/model.go @@ -0,0 +1,15 @@ +package limits + +import "github.com/openziti/zrok/controller/store" + +type AccountStrategy interface { + HandleAccount(a *store.Account, rxBytes, txBytes int64, limit *BandwidthPerPeriod) error +} + +type EnvironmentStrategy interface { + HandleEnvironment(e *store.Environment, rxBytes, txBytes int64, limit *BandwidthPerPeriod) error +} + +type ShareStrategy interface { + HandleShare(s *store.Share, rxBytes, txBytes int64, limit *BandwidthPerPeriod) error +}