mirror of
https://github.com/vbatts/tar-split.git
synced 2025-07-15 12:19:09 +00:00
WIP
This commit is contained in:
parent
e2a62d6b0d
commit
5c8d5cacba
13 changed files with 265 additions and 50 deletions
|
@ -44,7 +44,7 @@ func (jup *jsonUnpacker) Next() (*Entry, error) {
|
|||
}
|
||||
|
||||
// check for dup name
|
||||
if e.Type == FileType {
|
||||
if e.Type == FileCheckEntry {
|
||||
cName := filepath.Clean(e.GetName())
|
||||
if _, ok := jup.seen[cName]; ok {
|
||||
return nil, ErrDuplicatePath
|
||||
|
@ -55,8 +55,8 @@ func (jup *jsonUnpacker) Next() (*Entry, error) {
|
|||
return &e, err
|
||||
}
|
||||
|
||||
// NewJSONUnpacker provides an Unpacker that reads Entries (SegmentType and
|
||||
// FileType) as a json document.
|
||||
// NewJSONUnpacker provides an Unpacker that reads Entries (SegmentEntry and
|
||||
// FileCheckEntry) as a json document.
|
||||
//
|
||||
// Each Entry read are expected to be delimited by new line.
|
||||
func NewJSONUnpacker(r io.Reader) Unpacker {
|
||||
|
@ -85,7 +85,7 @@ func (jp *jsonPacker) AddEntry(e Entry) (int, error) {
|
|||
}
|
||||
|
||||
// check early for dup name
|
||||
if e.Type == FileType {
|
||||
if e.Type == FileCheckEntry {
|
||||
cName := filepath.Clean(e.GetName())
|
||||
if _, ok := jp.seen[cName]; ok {
|
||||
return -1, ErrDuplicatePath
|
||||
|
@ -104,8 +104,8 @@ func (jp *jsonPacker) AddEntry(e Entry) (int, error) {
|
|||
return e.Position, nil
|
||||
}
|
||||
|
||||
// NewJSONPacker provides a Packer that writes each Entry (SegmentType and
|
||||
// FileType) as a json document.
|
||||
// NewJSONPacker provides a Packer that writes each Entry (SegmentEntry and
|
||||
// FileCheckEntry) as a json document.
|
||||
//
|
||||
// The Entries are delimited by new line.
|
||||
func NewJSONPacker(w io.Writer) Packer {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue