LedgerClient admin pruning hook (#15679)

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Oliver Seeliger 2022-11-24 20:35:33 +01:00 committed by GitHub
parent 5f4beecccd
commit da67ee7066
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 1 deletions

View File

@ -4,12 +4,12 @@
package com.daml.ledger.client
import java.io.Closeable
import com.daml.grpc.adapter.ExecutionSequencerFactory
import com.daml.ledger.api.auth.client.LedgerCallCredentials.authenticatingStub
import com.daml.ledger.api.domain.LedgerId
import com.daml.ledger.api.v1.active_contracts_service.ActiveContractsServiceGrpc
import com.daml.ledger.api.v1.admin.package_management_service.PackageManagementServiceGrpc
import com.daml.ledger.api.v1.admin.participant_pruning_service.ParticipantPruningServiceGrpc
import com.daml.ledger.api.v1.admin.party_management_service.PartyManagementServiceGrpc
import com.daml.ledger.api.v1.admin.user_management_service.UserManagementServiceGrpc
import com.daml.ledger.api.v1.command_completion_service.CommandCompletionServiceGrpc
@ -26,6 +26,7 @@ import com.daml.ledger.client.configuration.{
import com.daml.ledger.client.services.acs.ActiveContractSetClient
import com.daml.ledger.client.services.admin.{
PackageManagementClient,
ParticipantPruningManagementClient,
PartyManagementClient,
UserManagementClient,
}
@ -93,6 +94,11 @@ final class LedgerClient private (
LedgerClient.stub(UserManagementServiceGrpc.stub(channel), config.token)
)
val participantPruningManagementClient: ParticipantPruningManagementClient =
new ParticipantPruningManagementClient(
LedgerClient.stub(ParticipantPruningServiceGrpc.stub(channel), config.token)
)
override def close(): Unit = GrpcChannel.close(channel)
}

View File

@ -0,0 +1,25 @@
// Copyright (c) 2022 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved.
// SPDX-License-Identifier: Apache-2.0
package com.daml.ledger.client.services.admin
import com.daml.ledger.api.v1.admin.participant_pruning_service.ParticipantPruningServiceGrpc.ParticipantPruningServiceStub
import com.daml.ledger.api.v1.admin.participant_pruning_service.{PruneRequest, PruneResponse}
import com.daml.ledger.client.LedgerClient
import scala.concurrent.Future
object ParticipantPruningManagementClient {
private def pruneRequest(pruneUpTo: String) = PruneRequest(pruneUpTo = pruneUpTo)
}
final class ParticipantPruningManagementClient(service: ParticipantPruningServiceStub) {
def prune(pruneUpTo: String, token: Option[String] = None): Future[PruneResponse] =
LedgerClient
.stub(service, token)
.prune(ParticipantPruningManagementClient.pruneRequest(pruneUpTo))
}