Suppression fichier : fonctionnelle
This commit is contained in:
45
pkg/protocol/rules/writers/EraseErrorRule.go
Normal file
45
pkg/protocol/rules/writers/EraseErrorRule.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package writers
|
||||
|
||||
import (
|
||||
"StoreBackEnd/pkg/protocol"
|
||||
)
|
||||
|
||||
//EraseErrorRulePrefix Rule command prefix
|
||||
const EraseErrorRulePrefix = "ERASE_ERROR"
|
||||
|
||||
// EraseErrorRule Storage structure for the EraseErrorRule
|
||||
type EraseErrorRule struct {
|
||||
// cmd Rule name
|
||||
cmd string
|
||||
// matcher Allow to make a regex match
|
||||
matcher *protocol.RegexMatcher
|
||||
}
|
||||
|
||||
// CreateEraseErrorRule Creating an instance of EraseErrorRule
|
||||
func CreateEraseErrorRule(pattern string) protocol.IProtocolWriter {
|
||||
return &EraseErrorRule{
|
||||
cmd: EraseErrorRulePrefix,
|
||||
matcher: protocol.CreateRegexMatcher(pattern),
|
||||
}
|
||||
}
|
||||
|
||||
// GetCmd retrieve the command name.
|
||||
func (rule EraseErrorRule) GetCmd() string {
|
||||
return rule.cmd
|
||||
}
|
||||
|
||||
// Execute the Rule with a string command.
|
||||
func (rule EraseErrorRule) Execute(argsData ...string) *protocol.ProtocolWriterResult {
|
||||
buildedCmd, _ := rule.matcher.Build(EraseErrorRulePrefix, argsData...)
|
||||
|
||||
return &protocol.ProtocolWriterResult{
|
||||
Cmd: buildedCmd,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func onWrite(writer *bufio.Writer) {
|
||||
println("Ecriture du fichier sur le réseau")
|
||||
}
|
||||
|
||||
*/
|
||||
45
pkg/protocol/rules/writers/EraseOkRule.go
Normal file
45
pkg/protocol/rules/writers/EraseOkRule.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package writers
|
||||
|
||||
import (
|
||||
"StoreBackEnd/pkg/protocol"
|
||||
)
|
||||
|
||||
//EraseOkRulePrefix Rule command prefix
|
||||
const EraseOkRulePrefix = "ERASE_OK"
|
||||
|
||||
// EraseOkRule Storage structure for the EraseOkRule
|
||||
type EraseOkRule struct {
|
||||
// cmd Rule name
|
||||
cmd string
|
||||
// matcher Allow to make a regex match
|
||||
matcher *protocol.RegexMatcher
|
||||
}
|
||||
|
||||
// CreateEraseOkRule Creating an instance of EraseOkRule
|
||||
func CreateEraseOkRule(pattern string) protocol.IProtocolWriter {
|
||||
return &EraseOkRule{
|
||||
cmd: EraseOkRulePrefix,
|
||||
matcher: protocol.CreateRegexMatcher(pattern),
|
||||
}
|
||||
}
|
||||
|
||||
// GetCmd retrieve the command name.
|
||||
func (rule EraseOkRule) GetCmd() string {
|
||||
return rule.cmd
|
||||
}
|
||||
|
||||
// Execute the Rule with a string command.
|
||||
func (rule EraseOkRule) Execute(argsData ...string) *protocol.ProtocolWriterResult {
|
||||
buildedCmd, _ := rule.matcher.Build(EraseOkRulePrefix, argsData...)
|
||||
|
||||
return &protocol.ProtocolWriterResult{
|
||||
Cmd: buildedCmd,
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
func onWrite(writer *bufio.Writer) {
|
||||
println("Ecriture du fichier sur le réseau")
|
||||
}
|
||||
|
||||
*/
|
||||
Reference in New Issue
Block a user