Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Unified Diff: common/dirwalk/tests/tools/walkdir/walkers_base.go

Issue 2054763004: luci-go/common/dirwalk: Code for walking a directory tree efficiently Base URL: https://github.com/luci/luci-go@master
Patch Set: Fixes. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: common/dirwalk/tests/tools/walkdir/walkers_base.go
diff --git a/common/dirwalk/tests/tools/walkdir/walkers_base.go b/common/dirwalk/tests/tools/walkdir/walkers_base.go
new file mode 100644
index 0000000000000000000000000000000000000000..6efb2987741c42663e3041682838035fb0536e54
--- /dev/null
+++ b/common/dirwalk/tests/tools/walkdir/walkers_base.go
@@ -0,0 +1,28 @@
+// Copyright 2016 The LUCI Authors. All rights reserved.
+// Use of this source code is governed under the Apache License, Version 2.0
+// that can be found in the LICENSE file.
+
+package main
+
+import (
+ "log"
+ "sync/atomic"
+)
+
+// BaseWalker implements Walker. It counts the number of files of each type.
+type BaseWalker struct {
+ smallfiles uint64
+ largefiles uint64
+}
+
+func (n *BaseWalker) SmallFile(filename string, alldata []byte) {
+ atomic.AddUint64(&n.smallfiles, 1)
+}
+func (n *BaseWalker) LargeFile(filename string) {
+ atomic.AddUint64(&n.largefiles, 1)
+}
+func (n *BaseWalker) Error(pathname string, err error) {
+ log.Fatalf("%s:%s", pathname, err)
+}
+func (n *BaseWalker) Finished() {
+}

Powered by Google App Engine
This is Rietveld 408576698