From e8965385b332d2209ae8a8600bf16f717f990143 Mon Sep 17 00:00:00 2001 From: Benjamin Date: Sun, 20 Feb 2022 11:33:47 +0100 Subject: [PATCH] =?UTF-8?q?Ajout=20de=20IProtocolReader.go=20IProtocolRead?= =?UTF-8?q?er.go=20=C3=A0=20la=20place=20de=20IProtocol.go=20ainsi=20que?= =?UTF-8?q?=20les=20dossiers=20appropri=C3=A9s=20pour=20chaque=20type=20de?= =?UTF-8?q?=20r=C3=A8gle?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/protocol/{IProtocol.go => IProtocolReader.go} | 4 ++-- pkg/protocol/IProtocolWriter.go | 8 ++++++++ pkg/protocol/rules/{ => readers}/EraseFileRule.go | 4 ++-- pkg/protocol/rules/writers/HelloRule.go | 1 + 4 files changed, 13 insertions(+), 4 deletions(-) rename pkg/protocol/{IProtocol.go => IProtocolReader.go} (59%) create mode 100644 pkg/protocol/IProtocolWriter.go rename pkg/protocol/rules/{ => readers}/EraseFileRule.go (94%) create mode 100644 pkg/protocol/rules/writers/HelloRule.go diff --git a/pkg/protocol/IProtocol.go b/pkg/protocol/IProtocolReader.go similarity index 59% rename from pkg/protocol/IProtocol.go rename to pkg/protocol/IProtocolReader.go index cfa3df9..a806c69 100644 --- a/pkg/protocol/IProtocol.go +++ b/pkg/protocol/IProtocolReader.go @@ -1,7 +1,7 @@ package protocol -// IProtocol Représentation abstraite d'un protocol -type IProtocol interface { +// IProtocolReader Représentation abstraite d'un protocol +type IProtocolReader interface { // Permet de vérifier la validité d'une donnée censée suivre les règles d'un protocol execute(data string) diff --git a/pkg/protocol/IProtocolWriter.go b/pkg/protocol/IProtocolWriter.go new file mode 100644 index 0000000..ca7a045 --- /dev/null +++ b/pkg/protocol/IProtocolWriter.go @@ -0,0 +1,8 @@ +package protocol + +// IProtocolReader Représentation abstraite d'un protocol +type IProtocolWriter interface { + + // Permet de vérifier la validité d'une donnée censée suivre les règles d'un protocol + execute(argsData []string) +} diff --git a/pkg/protocol/rules/EraseFileRule.go b/pkg/protocol/rules/readers/EraseFileRule.go similarity index 94% rename from pkg/protocol/rules/EraseFileRule.go rename to pkg/protocol/rules/readers/EraseFileRule.go index 253c827..eead8db 100644 --- a/pkg/protocol/rules/EraseFileRule.go +++ b/pkg/protocol/rules/readers/EraseFileRule.go @@ -1,10 +1,10 @@ -package rules +package readers import "_StorBackEnd/pkg/protocol" // EraseFileRule Demande de suppression d'un fichier type EraseFileRule struct { - protocol.IProtocol + protocol.IProtocolReader // Cmd Nom de la règle Cmd string diff --git a/pkg/protocol/rules/writers/HelloRule.go b/pkg/protocol/rules/writers/HelloRule.go new file mode 100644 index 0000000..32b3f9b --- /dev/null +++ b/pkg/protocol/rules/writers/HelloRule.go @@ -0,0 +1 @@ +package writers