-
Notifications
You must be signed in to change notification settings - Fork 3
/
environments.go
22 lines (20 loc) · 1.05 KB
/
environments.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package env
// WEnvironment can be used to inject a custom file writer that is different from normal WriteCloser.
// This is useful when, for example there is a custom chunking code.
type WEnvironment interface {
// WriteFrame is called each time frame is encoded and needs to be written upstream.
WriteFrame(p []byte) (n int, err error)
// WriteSeekTable is called on Close to flush the seek table.
WriteSeekTable(p []byte) (n int, err error)
}
// REnvironment can be used to inject a custom file reader that is different from normal ReadSeeker.
// This is useful when, for example there is a custom chunking code.
type REnvironment interface {
// GetFrameByIndex returns the compressed frame by its index.
GetFrameByIndex(index FrameOffsetEntry) ([]byte, error)
// ReadFooter returns buffer whose last 9 bytes are interpreted as a `Seek_Table_Footer`.
ReadFooter() ([]byte, error)
// ReadSkipFrame returns the full Seek Table Skippable frame
// including the `Skippable_Magic_Number` and `Frame_Size`.
ReadSkipFrame(skippableFrameOffset int64) ([]byte, error)
}