summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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.