-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#9 Clean code, add validator outline
- Loading branch information
1 parent
b450fec
commit 81d1811
Showing
2 changed files
with
22 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
package ddosml | ||
|
||
// Validator is a core of the ddosml, it validates | ||
import "context" | ||
|
||
type RequestRepository interface { | ||
CreateRequest(ctx context.Context, req *Request) error | ||
} | ||
|
||
// MLBasedModelValidator is a core of the ddosml, it validates | ||
// each request against trained model and from time to time, | ||
// it's retraining the model against new data, and also it | ||
// clears database. | ||
type Validator struct { | ||
type MLBasedModelValidator struct { | ||
repository RequestRepository | ||
} | ||
|
||
func NewMlModelValidator(repository RequestRepository) *MLBasedModelValidator { | ||
return &MLBasedModelValidator{repository: repository} | ||
} |