summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdoardo La Greca2025-08-10 15:23:56 +0200
committerEdoardo La Greca2025-08-10 15:23:56 +0200
commit4e1e83f3b9ab586ad87c3d9e2016af5bf2f0035b (patch)
tree706b29909678973a30181e42b3383778abf64bd9
parent13a4b95ca0bdd402cf9a06989cb8397e3d0bf9ed (diff)
implement remove
-rw-r--r--src/main/kotlin/Connection.kt13
-rw-r--r--src/main/kotlin/ProtocolTranslator.kt6
2 files changed, 16 insertions, 3 deletions
diff --git a/src/main/kotlin/Connection.kt b/src/main/kotlin/Connection.kt
index c77a381..5db6b51 100644
--- a/src/main/kotlin/Connection.kt
+++ b/src/main/kotlin/Connection.kt
@@ -271,8 +271,17 @@ class Connection(transLay: TransportLayer) : ProtocolTranslator {
val imsg = checkedInMessage(omsg.tag)
}
- override fun remove(path: String) {
- TODO("Not yet implemented")
+ override fun remove(fid: UInt) {
+ val omsg = OutMessage(NinePMessageType.TREMOVE, this.tagGen.generate(), listOf("fid"),
+ mapOf(
+ "fid" to Pair(BigInteger(fid.toString()), 4u)
+ ),
+ emptyMap(),
+ emptyMap(),
+ this.maxSize
+ )
+ omsg.write(this.tl)
+ val imsg = checkedInMessage(omsg.tag)
}
override fun stat(path: String) {
diff --git a/src/main/kotlin/ProtocolTranslator.kt b/src/main/kotlin/ProtocolTranslator.kt
index 6747e98..5148120 100644
--- a/src/main/kotlin/ProtocolTranslator.kt
+++ b/src/main/kotlin/ProtocolTranslator.kt
@@ -138,8 +138,12 @@ interface ProtocolTranslator {
/**
* Remove a file from a server.
+ *
+ * @param fid The FID of the file to remove.
+ * @throws except.InvalidMessageException if the received message is invalid.
+ * @throws except.RErrorException if the received message is an R-error message.
*/
- fun remove(path: String)
+ fun remove(fid: UInt)
/**
* Inquire file attributes.