MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / remove

Method remove

sqlchain/ackindex.go:80–102  ·  view source on GitHub ↗
(ack *types.SignedAckHeader)

Source from the content-addressed store, hash-verified

78}
79
80func (i *multiAckIndex) remove(ack *types.SignedAckHeader) (err error) {
81 var key = ack.GetQueryKey()
82 log.Debugf("removing key %s -x- ack %s", &key, ack.Hash())
83 i.Lock()
84 defer i.Unlock()
85 if _, ok := i.respIndex[key]; ok {
86 delete(i.respIndex, key)
87 atomic.AddInt32(&i.owner.responseCount, -1)
88 return
89 }
90 if oack, ok := i.ackIndex[key]; ok {
91 if oack.Hash() != ack.Hash() {
92 err = errors.Wrapf(
93 ErrMultipleAckOfSeqNo, "remove key %s -x- ack %s", &key, ack.Hash())
94 return
95 }
96 delete(i.ackIndex, key)
97 atomic.AddInt32(&i.owner.ackCount, -1)
98 return
99 }
100 err = errors.Wrapf(ErrQueryNotFound, "remove key %s -x- ack %s", &key, ack.Hash())
101 return
102}
103
104func (i *multiAckIndex) acks() (ret []*types.SignedAckHeader) {
105 i.RLock()

Callers 1

removeMethod · 0.95

Calls 3

DebugfFunction · 0.92
HashMethod · 0.65
GetQueryKeyMethod · 0.45

Tested by

no test coverage detected