@@ -157,7 +157,7 @@ func (f *Finder) Run(ctx context.Context) {
157157 prefixes = f .srcClient .ListCommonPrefixes (ctx , f .cfg .FinderDepth , f .cfg .MaxKeys )
158158 }
159159 var wg sync.WaitGroup
160- var total_obj_count int64 = 0
160+ var totalObjCount int64 = 0
161161
162162 start := time .Now ()
163163
@@ -166,9 +166,9 @@ func (f *Finder) Run(ctx context.Context) {
166166 log .Printf ("prefix: %s" , * p )
167167 wg .Add (1 )
168168 if f .cfg .SkipCompare {
169- go f .directSend (ctx , p , batchCh , msgCh , compareCh , & wg , & total_obj_count )
169+ go f .directSend (ctx , p , batchCh , msgCh , compareCh , & wg , & totalObjCount )
170170 } else {
171- go f .compareAndSend (ctx , p , batchCh , msgCh , compareCh , & wg , & total_obj_count )
171+ go f .compareAndSend (ctx , p , batchCh , msgCh , compareCh , & wg , & totalObjCount )
172172 }
173173 }
174174 wg .Wait ()
@@ -178,7 +178,7 @@ func (f *Finder) Run(ctx context.Context) {
178178 close (compareCh )
179179
180180 end := time .Since (start )
181- log .Printf ("Finder Job Completed in %v, found %d objects in total\n " , end , total_obj_count )
181+ log .Printf ("Finder Job Completed in %v, found %d objects in total\n " , end , totalObjCount )
182182}
183183
184184// List objects in destination bucket, load the full list into a map
@@ -216,15 +216,15 @@ func (f *Finder) getTargetObjects(ctx context.Context, prefix *string) (objects
216216
217217// This function will compare source and target and get a list of delta,
218218// and then send delta to SQS Queue.
219- func (f * Finder ) compareAndSend (ctx context.Context , prefix * string , batchCh chan struct {}, msgCh chan * string , compareCh chan struct {}, wg * sync.WaitGroup , total_obj_count * int64 ) {
219+ func (f * Finder ) compareAndSend (ctx context.Context , prefix * string , batchCh chan struct {}, msgCh chan * string , compareCh chan struct {}, wg * sync.WaitGroup , totalObjCount * int64 ) {
220220 defer wg .Done ()
221221
222222 log .Printf ("Comparing within prefix /%s\n " , * prefix )
223223 target := f .getTargetObjects (ctx , prefix )
224224
225225 token := ""
226226 i , j := 0 , 0
227- var obj_count int64 = 0
227+ var objCount int64 = 0
228228 retry := 0
229229 // batch := make([]*string, f.cfg.MessageBatchSize)
230230
@@ -264,7 +264,7 @@ func (f *Finder) compareAndSend(ctx context.Context, prefix *string, batchCh cha
264264 i ++
265265 if i % f .cfg .MessageBatchSize == 0 {
266266 wg .Add (1 )
267- obj_count += int64 (f .cfg .MessageBatchSize )
267+ objCount += int64 (f .cfg .MessageBatchSize )
268268 j ++
269269 if j % 100 == 0 {
270270 log .Printf ("Found %d batches in prefix /%s\n " , j , * prefix )
@@ -290,7 +290,7 @@ func (f *Finder) compareAndSend(ctx context.Context, prefix *string, batchCh cha
290290 // For remainning objects.
291291 if i != 0 {
292292 j ++
293- obj_count += int64 (i )
293+ objCount += int64 (i )
294294 wg .Add (1 )
295295 batchCh <- struct {}{}
296296 go func (i int ) {
@@ -304,23 +304,23 @@ func (f *Finder) compareAndSend(ctx context.Context, prefix *string, batchCh cha
304304 <- batchCh
305305 }(i )
306306 }
307- atomic .AddInt64 (total_obj_count , obj_count )
307+ atomic .AddInt64 (totalObjCount , objCount )
308308
309309 // end := time.Since(start)
310310 // log.Printf("Compared and Sent %d batches in %v", j, end)
311- log .Printf ("Completed in prefix /%s, found %d batches (%d objects) in total" , * prefix , j , obj_count )
311+ log .Printf ("Completed in prefix /%s, found %d batches (%d objects) in total" , * prefix , j , objCount )
312312 <- compareCh
313313}
314314
315315// This function will send the task to SQS Queue directly, without comparison.
316- func (f * Finder ) directSend (ctx context.Context , prefix * string , batchCh chan struct {}, msgCh chan * string , compareCh chan struct {}, wg * sync.WaitGroup , total_obj_count * int64 ) {
316+ func (f * Finder ) directSend (ctx context.Context , prefix * string , batchCh chan struct {}, msgCh chan * string , compareCh chan struct {}, wg * sync.WaitGroup , totalObjCount * int64 ) {
317317 defer wg .Done ()
318318
319319 log .Printf ("Scanning prefix /%s\n " , * prefix )
320320
321321 token := ""
322322 i , j := 0 , 0
323- var obj_count int64 = 0
323+ var objCount int64 = 0
324324 retry := 0
325325 // batch := make([]*string, f.cfg.MessageBatchSize)
326326
@@ -357,7 +357,7 @@ func (f *Finder) directSend(ctx context.Context, prefix *string, batchCh chan st
357357 i ++
358358 if i % f .cfg .MessageBatchSize == 0 {
359359 wg .Add (1 )
360- obj_count += int64 (f .cfg .MessageBatchSize )
360+ objCount += int64 (f .cfg .MessageBatchSize )
361361 j ++
362362 if j % 100 == 0 {
363363 log .Printf ("Found %d batches in prefix /%s\n " , j , * prefix )
@@ -382,7 +382,7 @@ func (f *Finder) directSend(ctx context.Context, prefix *string, batchCh chan st
382382 // For remainning objects.
383383 if i != 0 {
384384 j ++
385- obj_count += int64 (i )
385+ objCount += int64 (i )
386386 wg .Add (1 )
387387 batchCh <- struct {}{}
388388 go func (i int ) {
@@ -396,11 +396,11 @@ func (f *Finder) directSend(ctx context.Context, prefix *string, batchCh chan st
396396 <- batchCh
397397 }(i )
398398 }
399- atomic .AddInt64 (total_obj_count , obj_count )
399+ atomic .AddInt64 (totalObjCount , objCount )
400400
401401 // end := time.Since(start)
402402 // log.Printf("Compared and Sent %d batches in %v", j, end)
403- log .Printf ("Completed in prefix /%s, found %d batches (%d objects) in total" , * prefix , j , obj_count )
403+ log .Printf ("Completed in prefix /%s, found %d batches (%d objects) in total" , * prefix , j , objCount )
404404 <- compareCh
405405}
406406
0 commit comments