Пример #1
0
// mr.Input interface
func (in DirInput) Iterator(index int) (sophie.IterateCloser, error) {
	infos, err := in.Fs.ReadDir(in.Path)
	if err != nil {
		return nil, err
	}

	return NewReader(sophie.FsPath(in).Join(infos[index].Name()))
}
Пример #2
0
// Clean removes the folder.
func (out DirOutput) Clean() error {
	return sophie.FsPath(out).Remove()
}
Пример #3
0
// mr.Output interface
func (out DirOutput) Collector(index int) (sophie.CollectCloser, error) {
	if err := out.Fs.Mkdir(out.Path, 0755); err != nil {
		return nil, err
	}
	return NewWriter(sophie.FsPath(out).Join(fmt.Sprintf("part-%05d", index)))
}