2022-02-20 11:33:47 +01:00
|
|
|
package readers
|
2022-02-19 18:10:52 +01:00
|
|
|
|
|
|
|
import "_StorBackEnd/pkg/protocol"
|
|
|
|
|
|
|
|
// EraseFileRule Demande de suppression d'un fichier
|
|
|
|
type EraseFileRule struct {
|
2022-02-20 11:33:47 +01:00
|
|
|
protocol.IProtocolReader
|
2022-02-19 18:10:52 +01:00
|
|
|
// 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")
|
|
|
|
}
|
|
|
|
}
|