zip

package
v0.0.0-...-5012a73 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 20, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileHeaderPile

type FileHeaderPile struct {
	// contains filtered or unexported fields
}

FileHeaderPile is a hybrid container for a lazily and concurrently populated growing-only slice of items (of type `*zip.FileHeader`) which may be traversed in parallel to it's growth.

Usage for a pile `p`:

p := MakeFileHeaderPile(128, 32)

Have it grow concurrently using multiple:

var item *zip.FileHeader = something
p.Pile(item)

in as many go routines as You may seem fit.

In parallel, You may either traverse `p` in parallel right away:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

Here p.Iter() starts a new transversal with the first item (if any), and p.Next() keeps traverses the FileHeaderPile.

or traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available:

r, p := <-p.Done(), nil

Hint: here we get the result in `r` and at the same time discard / deallocate / forget the pile `p` itself.

Note: The traversal is *not* intended to be concurrency safe! Thus: You may call `Pile` concurrently to Your traversal, but use of either `Done` or `Iter` and `Next` *must* be confined to a single go routine (thread).

func MakeFileHeaderPile

func MakeFileHeaderPile(size, buff int) *FileHeaderPile

MakeFileHeaderPile returns a (pointer to a) fresh pile of items (of type `*zip.FileHeader`) with size as initial capacity and with buff as initial leeway, allowing as many Pile's to execute non-blocking before respective Done or Next's.

func (*FileHeaderPile) Close

func (d *FileHeaderPile) Close() (err error)

Close - call once when everything has been piled.

Close intentionally implements io.Closer

Note: After Close(), any Close(...) will panic and any Pile(...) will panic and any Done() or Next() will return immediately: no eventual blocking, that is.

func (*FileHeaderPile) Done

func (d *FileHeaderPile) Done() (done <-chan []*zip.FileHeader)

Done returns a channel which emits the result (as slice of FileHeader) once the pile is closed.

Users of Done() *must not* iterate (via Iter() Next()...) before the done-channel is closed!

Done is a convenience - useful iff You do not like/need to start any traversal before the pile is fully populated. Once the pile is closed, Done() will signal in constant time.

Note: Upon signalling, the pile is reset to it's tip, so You may traverse it (via Next) right away. Usage for a pile `p`: Traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available

r, p := <-p.Done(), nil

while discaring the pile itself.

func (*FileHeaderPile) Iter

func (d *FileHeaderPile) Iter() (item *zip.FileHeader, ok bool)

Iter puts the pile iterator back to the beginning and returns the first `Next()`, iff any. Usage for a pile `p`:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

func (*FileHeaderPile) Next

func (d *FileHeaderPile) Next() (item *zip.FileHeader, ok bool)

Next returns the next item, or false iff the pile is exhausted.

Note: Iff the pile is not closed yet, Next may block, awaiting some Pile().

func (*FileHeaderPile) Pile

func (d *FileHeaderPile) Pile(item *zip.FileHeader)

Pile appends an `*zip.FileHeader` item to the FileHeaderPile.

Note: Pile will block iff buff is exceeded and no Done() or Next()'s are used.

type FilePile

type FilePile struct {
	// contains filtered or unexported fields
}

FilePile is a hybrid container for a lazily and concurrently populated growing-only slice of items (of type `*zip.File`) which may be traversed in parallel to it's growth.

Usage for a pile `p`:

p := MakeFilePile(128, 32)

Have it grow concurrently using multiple:

var item *zip.File = something
p.Pile(item)

in as many go routines as You may seem fit.

In parallel, You may either traverse `p` in parallel right away:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

Here p.Iter() starts a new transversal with the first item (if any), and p.Next() keeps traverses the FilePile.

or traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available:

r, p := <-p.Done(), nil

Hint: here we get the result in `r` and at the same time discard / deallocate / forget the pile `p` itself.

Note: The traversal is *not* intended to be concurrency safe! Thus: You may call `Pile` concurrently to Your traversal, but use of either `Done` or `Iter` and `Next` *must* be confined to a single go routine (thread).

func MakeFilePile

func MakeFilePile(size, buff int) *FilePile

MakeFilePile returns a (pointer to a) fresh pile of items (of type `*zip.File`) with size as initial capacity and with buff as initial leeway, allowing as many Pile's to execute non-blocking before respective Done or Next's.

func (*FilePile) Close

func (d *FilePile) Close() (err error)

Close - call once when everything has been piled.

Close intentionally implements io.Closer

Note: After Close(), any Close(...) will panic and any Pile(...) will panic and any Done() or Next() will return immediately: no eventual blocking, that is.

func (*FilePile) Done

func (d *FilePile) Done() (done <-chan []*zip.File)

Done returns a channel which emits the result (as slice of File) once the pile is closed.

Users of Done() *must not* iterate (via Iter() Next()...) before the done-channel is closed!

Done is a convenience - useful iff You do not like/need to start any traversal before the pile is fully populated. Once the pile is closed, Done() will signal in constant time.

Note: Upon signalling, the pile is reset to it's tip, so You may traverse it (via Next) right away. Usage for a pile `p`: Traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available

r, p := <-p.Done(), nil

while discaring the pile itself.

func (*FilePile) Iter

func (d *FilePile) Iter() (item *zip.File, ok bool)

Iter puts the pile iterator back to the beginning and returns the first `Next()`, iff any. Usage for a pile `p`:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

func (*FilePile) Next

func (d *FilePile) Next() (item *zip.File, ok bool)

Next returns the next item, or false iff the pile is exhausted.

Note: Iff the pile is not closed yet, Next may block, awaiting some Pile().

func (*FilePile) Pile

func (d *FilePile) Pile(item *zip.File)

Pile appends an `*zip.File` item to the FilePile.

Note: Pile will block iff buff is exceeded and no Done() or Next()'s are used.

type ReadCloserPile

type ReadCloserPile struct {
	// contains filtered or unexported fields
}

ReadCloserPile is a hybrid container for a lazily and concurrently populated growing-only slice of items (of type `*zip.ReadCloser`) which may be traversed in parallel to it's growth.

Usage for a pile `p`:

p := MakeReadCloserPile(128, 32)

Have it grow concurrently using multiple:

var item *zip.ReadCloser = something
p.Pile(item)

in as many go routines as You may seem fit.

In parallel, You may either traverse `p` in parallel right away:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

Here p.Iter() starts a new transversal with the first item (if any), and p.Next() keeps traverses the ReadCloserPile.

or traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available:

r, p := <-p.Done(), nil

Hint: here we get the result in `r` and at the same time discard / deallocate / forget the pile `p` itself.

Note: The traversal is *not* intended to be concurrency safe! Thus: You may call `Pile` concurrently to Your traversal, but use of either `Done` or `Iter` and `Next` *must* be confined to a single go routine (thread).

func MakeReadCloserPile

func MakeReadCloserPile(size, buff int) *ReadCloserPile

MakeReadCloserPile returns a (pointer to a) fresh pile of items (of type `*zip.ReadCloser`) with size as initial capacity and with buff as initial leeway, allowing as many Pile's to execute non-blocking before respective Done or Next's.

func (*ReadCloserPile) Close

func (d *ReadCloserPile) Close() (err error)

Close - call once when everything has been piled.

Close intentionally implements io.Closer

Note: After Close(), any Close(...) will panic and any Pile(...) will panic and any Done() or Next() will return immediately: no eventual blocking, that is.

func (*ReadCloserPile) Done

func (d *ReadCloserPile) Done() (done <-chan []*zip.ReadCloser)

Done returns a channel which emits the result (as slice of ReadCloser) once the pile is closed.

Users of Done() *must not* iterate (via Iter() Next()...) before the done-channel is closed!

Done is a convenience - useful iff You do not like/need to start any traversal before the pile is fully populated. Once the pile is closed, Done() will signal in constant time.

Note: Upon signalling, the pile is reset to it's tip, so You may traverse it (via Next) right away. Usage for a pile `p`: Traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available

r, p := <-p.Done(), nil

while discaring the pile itself.

func (*ReadCloserPile) Iter

func (d *ReadCloserPile) Iter() (item *zip.ReadCloser, ok bool)

Iter puts the pile iterator back to the beginning and returns the first `Next()`, iff any. Usage for a pile `p`:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

func (*ReadCloserPile) Next

func (d *ReadCloserPile) Next() (item *zip.ReadCloser, ok bool)

Next returns the next item, or false iff the pile is exhausted.

Note: Iff the pile is not closed yet, Next may block, awaiting some Pile().

func (*ReadCloserPile) Pile

func (d *ReadCloserPile) Pile(item *zip.ReadCloser)

Pile appends an `*zip.ReadCloser` item to the ReadCloserPile.

Note: Pile will block iff buff is exceeded and no Done() or Next()'s are used.

type ReaderPile

type ReaderPile struct {
	// contains filtered or unexported fields
}

ReaderPile is a hybrid container for a lazily and concurrently populated growing-only slice of items (of type `*zip.Reader`) which may be traversed in parallel to it's growth.

Usage for a pile `p`:

p := MakeReaderPile(128, 32)

Have it grow concurrently using multiple:

var item *zip.Reader = something
p.Pile(item)

in as many go routines as You may seem fit.

In parallel, You may either traverse `p` in parallel right away:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

Here p.Iter() starts a new transversal with the first item (if any), and p.Next() keeps traverses the ReaderPile.

or traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available:

r, p := <-p.Done(), nil

Hint: here we get the result in `r` and at the same time discard / deallocate / forget the pile `p` itself.

Note: The traversal is *not* intended to be concurrency safe! Thus: You may call `Pile` concurrently to Your traversal, but use of either `Done` or `Iter` and `Next` *must* be confined to a single go routine (thread).

func MakeReaderPile

func MakeReaderPile(size, buff int) *ReaderPile

MakeReaderPile returns a (pointer to a) fresh pile of items (of type `*zip.Reader`) with size as initial capacity and with buff as initial leeway, allowing as many Pile's to execute non-blocking before respective Done or Next's.

func (*ReaderPile) Close

func (d *ReaderPile) Close() (err error)

Close - call once when everything has been piled.

Close intentionally implements io.Closer

Note: After Close(), any Close(...) will panic and any Pile(...) will panic and any Done() or Next() will return immediately: no eventual blocking, that is.

func (*ReaderPile) Done

func (d *ReaderPile) Done() (done <-chan []*zip.Reader)

Done returns a channel which emits the result (as slice of Reader) once the pile is closed.

Users of Done() *must not* iterate (via Iter() Next()...) before the done-channel is closed!

Done is a convenience - useful iff You do not like/need to start any traversal before the pile is fully populated. Once the pile is closed, Done() will signal in constant time.

Note: Upon signalling, the pile is reset to it's tip, so You may traverse it (via Next) right away. Usage for a pile `p`: Traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available

r, p := <-p.Done(), nil

while discaring the pile itself.

func (*ReaderPile) Iter

func (d *ReaderPile) Iter() (item *zip.Reader, ok bool)

Iter puts the pile iterator back to the beginning and returns the first `Next()`, iff any. Usage for a pile `p`:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

func (*ReaderPile) Next

func (d *ReaderPile) Next() (item *zip.Reader, ok bool)

Next returns the next item, or false iff the pile is exhausted.

Note: Iff the pile is not closed yet, Next may block, awaiting some Pile().

func (*ReaderPile) Pile

func (d *ReaderPile) Pile(item *zip.Reader)

Pile appends an `*zip.Reader` item to the ReaderPile.

Note: Pile will block iff buff is exceeded and no Done() or Next()'s are used.

type WriterPile

type WriterPile struct {
	// contains filtered or unexported fields
}

WriterPile is a hybrid container for a lazily and concurrently populated growing-only slice of items (of type `*zip.Writer`) which may be traversed in parallel to it's growth.

Usage for a pile `p`:

p := MakeWriterPile(128, 32)

Have it grow concurrently using multiple:

var item *zip.Writer = something
p.Pile(item)

in as many go routines as You may seem fit.

In parallel, You may either traverse `p` in parallel right away:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

Here p.Iter() starts a new transversal with the first item (if any), and p.Next() keeps traverses the WriterPile.

or traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available:

r, p := <-p.Done(), nil

Hint: here we get the result in `r` and at the same time discard / deallocate / forget the pile `p` itself.

Note: The traversal is *not* intended to be concurrency safe! Thus: You may call `Pile` concurrently to Your traversal, but use of either `Done` or `Iter` and `Next` *must* be confined to a single go routine (thread).

func MakeWriterPile

func MakeWriterPile(size, buff int) *WriterPile

MakeWriterPile returns a (pointer to a) fresh pile of items (of type `*zip.Writer`) with size as initial capacity and with buff as initial leeway, allowing as many Pile's to execute non-blocking before respective Done or Next's.

func (*WriterPile) Close

func (d *WriterPile) Close() (err error)

Close - call once when everything has been piled.

Close intentionally implements io.Closer

Note: After Close(), any Close(...) will panic and any Pile(...) will panic and any Done() or Next() will return immediately: no eventual blocking, that is.

func (*WriterPile) Done

func (d *WriterPile) Done() (done <-chan []*zip.Writer)

Done returns a channel which emits the result (as slice of Writer) once the pile is closed.

Users of Done() *must not* iterate (via Iter() Next()...) before the done-channel is closed!

Done is a convenience - useful iff You do not like/need to start any traversal before the pile is fully populated. Once the pile is closed, Done() will signal in constant time.

Note: Upon signalling, the pile is reset to it's tip, so You may traverse it (via Next) right away. Usage for a pile `p`: Traverse blocking / awaiting close first:

for item := range <-p.Done() { ... do sth with item ... }

or use the result when available

r, p := <-p.Done(), nil

while discaring the pile itself.

func (*WriterPile) Iter

func (d *WriterPile) Iter() (item *zip.Writer, ok bool)

Iter puts the pile iterator back to the beginning and returns the first `Next()`, iff any. Usage for a pile `p`:

for item, ok := p.Iter(); ok; item, ok = p.Next() { ... do sth with item ... }

func (*WriterPile) Next

func (d *WriterPile) Next() (item *zip.Writer, ok bool)

Next returns the next item, or false iff the pile is exhausted.

Note: Iff the pile is not closed yet, Next may block, awaiting some Pile().

func (*WriterPile) Pile

func (d *WriterPile) Pile(item *zip.Writer)

Pile appends an `*zip.Writer` item to the WriterPile.

Note: Pile will block iff buff is exceeded and no Done() or Next()'s are used.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL