Buffer interface represents abstract temporary storage for blobs. The Buffer storage is assumed to be immutable. If any modifications are made - new storage location should be used for them. This is important to ensure goroutine-safety. Since Buffer objects require a careful management of lifetime
| 38 | // and storing it somewhere or applying implementation-specific methods (for example, |
| 39 | // the FileBuffer storage may be "re-buffered" by hard-linking the underlying file). |
| 40 | type Buffer interface { |
| 41 | // Open creates new Reader reading from the underlying storage. |
| 42 | Open() (io.ReadCloser, error) |
| 43 | |
| 44 | // Len reports the length of the stored blob. |
| 45 | // |
| 46 | // Notably, it indicates the amount of bytes that can be read from the |
| 47 | // newly created Reader without hiting io.EOF. |
| 48 | Len() int |
| 49 | |
| 50 | // Remove discards buffered body and releases all associated resources. |
| 51 | // |
| 52 | // Multiple Buffer objects may refer to the same underlying storage. |
| 53 | // In this case, care should be taken to ensure that Remove is called |
| 54 | // only once since it will discard the shared storage and invalidate |
| 55 | // all Buffer objects using it. |
| 56 | // |
| 57 | // Readers previously created using Open can still be used, but |
| 58 | // new ones can't be created. |
| 59 | Remove() error |
| 60 | } |
no outgoing calls
no test coverage detected