MCPcopy Create free account
hub / github.com/Shopify/ghostferry / Batches

Method Batches

inline_verifier.go:190–222  ·  view source on GitHub ↗
(batchsize int)

Source from the content-addressed store, hash-verified

188}
189
190func (s *BinlogVerifyStore) Batches(batchsize int) []BinlogVerifyBatch {
191 s.mutex.Lock()
192 defer s.mutex.Unlock()
193
194 batches := make([]BinlogVerifyBatch, 0)
195 for schemaName, _ := range s.store {
196 for tableName, paginationKeySet := range s.store[schemaName] {
197 paginationKeyBatch := make([]interface{}, 0, batchsize)
198
199 for paginationKeyStr, _ := range paginationKeySet {
200 paginationKeyBatch = append(paginationKeyBatch, paginationKeyStr)
201 if len(paginationKeyBatch) >= batchsize {
202 batches = append(batches, BinlogVerifyBatch{
203 SchemaName: schemaName,
204 TableName: tableName,
205 PaginationKeys: paginationKeyBatch,
206 })
207 paginationKeyBatch = make([]interface{}, 0, batchsize)
208 }
209 }
210
211 if len(paginationKeyBatch) > 0 {
212 batches = append(batches, BinlogVerifyBatch{
213 SchemaName: schemaName,
214 TableName: tableName,
215 PaginationKeys: paginationKeyBatch,
216 })
217 }
218 }
219 }
220
221 return batches
222}
223
224func (s *BinlogVerifyStore) CurrentRowCount() uint64 {
225 return s.currentRowCount

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected