2 glocate -- ZFS-diff-friendly locate-like utility
3 Copyright (C) 2022-2023 Sergey Matveev <stargrave@stargrave.org>
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, version 3 of the License.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 func index() *os.File {
27 tmp0, err := os.CreateTemp(TmpDir, "glocate-idx")
31 defer os.Remove(tmp0.Name())
33 entsWalker := make(chan Ent, 1<<10)
34 entsWriter := make(chan Ent, 1<<10)
35 dirSizerJob := make(chan struct{})
37 entsWalker <- Ent{name: []string{"./"}}
38 sinkBack := make(chan Ent, 1)
40 dirSizer(&dirSizes, 1, sinkBack, entsWalker, entsWriter)
44 writerJob := make(chan struct{})
46 writer(tmp0, entsWriter)
50 walkerStatusStop := make(chan struct{})
51 go walkerStatus(walkerStatusStop)
52 err = walker(entsWalker, []string{"./"})
53 walkerStatusStop <- struct{}{}
64 tmp1 := applyDirSizes(tmp0, dirSizes)