Ajout de IProtocolReader.go IProtocolReader.go à la place de IProtocol.go ainsi que les dossiers appropriés pour chaque type de règle
This commit is contained in:
31
pkg/protocol/rules/readers/EraseFileRule.go
Normal file
31
pkg/protocol/rules/readers/EraseFileRule.go
Normal file
@@ -0,0 +1,31 @@
|
||||
package readers
|
||||
|
||||
import "_StorBackEnd/pkg/protocol"
|
||||
|
||||
// EraseFileRule Demande de suppression d'un fichier
|
||||
type EraseFileRule struct {
|
||||
protocol.IProtocolReader
|
||||
// Cmd Nom de la règle
|
||||
Cmd string
|
||||
|
||||
// matcher Permet de vérifier le matching
|
||||
matcher *protocol.RegexMatcher
|
||||
}
|
||||
|
||||
// CreateEraseFileRule Création d'une instance de EraseFileRule
|
||||
func CreateEraseFileRule(cmd string, pattern string) *EraseFileRule {
|
||||
return &EraseFileRule{
|
||||
Cmd: cmd,
|
||||
matcher: protocol.CreateRegexMatcher(pattern),
|
||||
}
|
||||
}
|
||||
|
||||
func (rule EraseFileRule) execute(data string) {
|
||||
matcher := rule.matcher
|
||||
|
||||
if matcher.Match(data) {
|
||||
println("EraseFileRule data is matching")
|
||||
} else {
|
||||
println("EraseFileRule data isn't matching")
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user