Skip to content
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion internal/blockchain/common/common.go
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright © 2024 Kaleido, Inc.
// Copyright © 2025 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
Expand Down Expand Up @@ -43,6 +43,9 @@ type BlockchainCallbacks interface {
SetHandler(namespace string, handler blockchain.Callbacks)
SetOperationalHandler(namespace string, handler core.OperationCallbacks)

// BulkOperationUpdates is a way to update multiple operations and get notified when the updates have been committed to the database
BulkOperationUpdates(ctx context.Context, namespace string, updates []*core.OperationUpdate, onCommit chan<- error)

OperationUpdate(ctx context.Context, plugin core.Named, nsOpID string, status core.OpStatus, blockchainTXID, errorMessage string, opOutput fftypes.JSONObject)
// Common logic for parsing a BatchPinOrNetworkAction event, and if not discarded to add it to the by-namespace map
PrepareBatchPinOrNetworkAction(ctx context.Context, events EventsToDispatch, subInfo *SubscriptionInfo, location *fftypes.JSONAny, event *blockchain.Event, signingKey *core.VerifierRef, params *BatchPinParams)
Expand All @@ -64,6 +67,16 @@ type callbacks struct {
opHandlers map[string]core.OperationCallbacks
}

// BulkOperationUpdates implements BlockchainCallbacks.
func (cb *callbacks) BulkOperationUpdates(ctx context.Context, namespace string, updates []*core.OperationUpdate, onCommit chan<- error) {
if handler, ok := cb.opHandlers[namespace]; ok {
handler.BulkOperationUpdates(ctx, updates, onCommit)
return
}
// Need to clean this up
log.L(ctx).Errorf("No handler found for namespace '%s'", namespace)
}

type subscriptions struct {
subs map[string]*SubscriptionInfo
}
Expand Down
45 changes: 45 additions & 0 deletions internal/blockchain/paladin/config.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright © 2025 Kaleido, Inc.
//
// SPDX-License-Identifier: Apache-2.0
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package paladin

import (
"github.com/hyperledger/firefly-common/pkg/config"
"github.com/hyperledger/firefly-common/pkg/ffresty"
"github.com/hyperledger/firefly-common/pkg/wsclient"
)

const (
// PaladinClientConfigKey is a sub-key in the config to contain all the connection details for RPC client
PaladinRPCClientConfigKey = "rpc"

// PaladinClientConfigKey is a sub-key in the config to contain all the connection details for RPC client HTTP section
PaladinRPCHTTPClientConfigKey = "http"

// PaladinClientConfigKey is a sub-key in the config to contain all the connection details for RPC client WS section
PaladinRPCWSClientConfigKey = "ws"
)

func (p *Paladin) InitConfig(config config.Section) {
rpcConf := config.SubSection(PaladinRPCClientConfigKey)
wsRPCConf := rpcConf.SubSection(PaladinRPCWSClientConfigKey)
wsclient.InitConfig(wsRPCConf)

httpRPCConf := rpcConf.SubSection(PaladinRPCHTTPClientConfigKey)
ffresty.InitConfig(httpRPCConf)

// TODO Config for receipt listener?
}
Loading
Loading