Skip to content

Commit 0f6c94c

Browse files
author
Youri K
committed
add compact data rpc route
1 parent dcf64bd commit 0f6c94c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/main/protobuf/fossildbapi.proto

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,13 @@ message RestoreFromBackupReply {
130130
optional string errorMessage = 2;
131131
}
132132

133+
message CompactAllDataRequest {}
134+
135+
message CompactAllDataReply {
136+
required bool success = 1;
137+
optional string errorMessage = 2;
138+
}
139+
133140

134141
service FossilDB {
135142
rpc Health (HealthRequest) returns (HealthReply) {}
@@ -143,4 +150,5 @@ service FossilDB {
143150
rpc ListVersions (ListVersionsRequest) returns (ListVersionsReply) {}
144151
rpc Backup (BackupRequest) returns (BackupReply) {}
145152
rpc RestoreFromBackup (RestoreFromBackupRequest) returns (RestoreFromBackupReply) {}
153+
rpc CompactAllData (CompactAllDataRequest) returns (CompactAllDataReply) {}
146154
}

src/main/scala/com/scalableminds/fossildb/FossilDBGrpcImpl.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ class FossilDBGrpcImpl(storeManager: StoreManager)
9090
RestoreFromBackupReply(true)
9191
} {errorMsg => RestoreFromBackupReply(false, errorMsg)}
9292

93+
override def compactAllData(req: CompactAllDataRequest) = withExceptionHandler(req) {
94+
storeManager.compactAllData
95+
CompactAllDataReply(true)
96+
} {errorMsg => CompactAllDataReply(false, errorMsg)}
9397

9498
private def withExceptionHandler [T, R <: GeneratedMessage](request: R)(tryBlock: => T)(onErrorBlock: Option[String] => T): Future[T] = {
9599
try {

0 commit comments

Comments
 (0)