shad-go/distbuild/pkg/tarstream/README.md
2020-04-04 17:28:13 +03:00

21 lines
1,016 B
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# tarstream
Вам нужно уметь передавать директорию с артефактами между воркерами. Для этого, вам нужно
реализовать две операции:
```go
package tarstream
import "io"
// Send рекурсивно обходит директорию и сериализует её содержимое в поток w.
func Send(dir string, w io.Writer) error
// Receive читает поток r и материализует содержимое потока внутри dir.
func Receive(dir string, r io.Reader) error
```
- Функции должны корректно обрабатывать директории и обычные файлы.
- executable бит на файлах должен сохраняться.
- Используйте формат [tar](https://golang.org/pkg/archive/tar/)
- Используйте [filepath.Walk](https://golang.org/pkg/path/filepath/) для рекурсивного обхода.