From 9656cca4f3f7620e19c90f61c1c30fb8b05a5f96 Mon Sep 17 00:00:00 2001 From: Justin Schuldt Date: Mon, 27 Dec 2021 12:21:47 -0600 Subject: [PATCH] export MakeRowKey in bigtablewriter.go (#650) So it can be used elsewhere, in cloud functions. --- node/pkg/reporter/bigtablewriter.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/node/pkg/reporter/bigtablewriter.go b/node/pkg/reporter/bigtablewriter.go index 54d199fb..b553f66a 100644 --- a/node/pkg/reporter/bigtablewriter.go +++ b/node/pkg/reporter/bigtablewriter.go @@ -28,7 +28,7 @@ type bigTableWriter struct { } // rowKey returns a string with the input vales delimited by colons. -func makeRowKey(emitterChain vaa.ChainID, emitterAddress vaa.Address, sequence uint64) string { +func MakeRowKey(emitterChain vaa.ChainID, emitterAddress vaa.Address, sequence uint64) string { // left-pad the sequence with zeros to 16 characters, because bigtable keys are stored lexicographically return fmt.Sprintf("%d:%s:%016d", emitterChain, emitterAddress, sequence) } @@ -92,7 +92,7 @@ func BigTableWriter(events *AttestationEventReporter, connectionConfig *BigTable bigtable.ColumnFilter("EmitterAddress")) conditionalMutation := bigtable.NewCondMutation(filter, nil, mutation) - rowKey := makeRowKey(msg.VAA.EmitterChain, msg.VAA.EmitterAddress, msg.VAA.Sequence) + rowKey := MakeRowKey(msg.VAA.EmitterChain, msg.VAA.EmitterAddress, msg.VAA.Sequence) err := tbl.Apply(ctx, rowKey, conditionalMutation) if err != nil { logger.Warn("Failed to write message publication to BigTable", @@ -119,7 +119,7 @@ func BigTableWriter(events *AttestationEventReporter, connectionConfig *BigTable bigtable.ColumnFilter("SignedVAA")) conditionalMutation := bigtable.NewCondMutation(filter, nil, mutation) - rowKey := makeRowKey(msg.EmitterChain, msg.EmitterAddress, msg.Sequence) + rowKey := MakeRowKey(msg.EmitterChain, msg.EmitterAddress, msg.Sequence) err := tbl.Apply(ctx, rowKey, conditionalMutation) if err != nil { logger.Warn("Failed to write persistence info to BigTable",