Documentation ¶
Overview ¶
Copyright 2022 Codenotary Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2022 Codenotary Inc. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- type AppendableFile
- func (aof *AppendableFile) Append(bs []byte) (off int64, n int, err error)
- func (aof *AppendableFile) Close() error
- func (aof *AppendableFile) CompressionFormat() int
- func (aof *AppendableFile) CompressionLevel() int
- func (aof *AppendableFile) Copy(dstPath string) error
- func (aof *AppendableFile) DiscardUpto(off int64) error
- func (aof *AppendableFile) Flush() error
- func (aof *AppendableFile) Metadata() []byte
- func (aof *AppendableFile) Offset() int64
- func (aof *AppendableFile) ReadAt(bs []byte, off int64) (n int, err error)
- func (aof *AppendableFile) SetOffset(newOffset int64) error
- func (aof *AppendableFile) Size() (int64, error)
- func (aof *AppendableFile) SwitchToReadOnlyMode() error
- func (aof *AppendableFile) Sync() error
- type Options
- func (opts *Options) GetCompressionFormat() int
- func (opts *Options) GetCompressionLevel() int
- func (opts *Options) GetReadBufferSize() int
- func (opts *Options) GetWriteBuffer() []byte
- func (opts *Options) Validate() error
- func (opts *Options) WithAutoSync(autoSync bool) *Options
- func (opts *Options) WithCompresionLevel(compressionLevel int) *Options
- func (opts *Options) WithCompressionFormat(compressionFormat int) *Options
- func (opts *Options) WithFileMode(fileMode os.FileMode) *Options
- func (opts *Options) WithMetadata(metadata []byte) *Options
- func (opts *Options) WithReadBufferSize(size int) *Options
- func (opts *Options) WithReadOnly(readOnly bool) *Options
- func (opts *Options) WithRetryableSync(retryableSync bool) *Options
- func (opts *Options) WithWriteBuffer(b []byte) *Options
Constants ¶
const DefaultCompressionFormat = appendable.DefaultCompressionFormat
const DefaultCompressionLevel = appendable.DefaultCompressionLevel
const DefaultFileMode = os.FileMode(0644)
const DefaultReadBufferSize = 4096
const DefaultWriteBufferSize = 4096
Variables ¶
var ErrAlreadyClosed = errors.New("singleapp: already closed")
var ErrBufferFull = errors.New("singleapp: buffer full")
var ErrCorruptedMetadata = errors.New("singleapp: corrupted metadata")
var ErrIllegalArguments = errors.New("singleapp: illegal arguments")
var ErrInvalidOptions = fmt.Errorf("%w: invalid options", ErrIllegalArguments)
var ErrNegativeOffset = errors.New("singleapp: negative offset")
var ErrReadOnly = errors.New("singleapp: read-only mode")
var ErrorPathIsNotADirectory = errors.New("singleapp: path is not a directory")
Functions ¶
This section is empty.
Types ¶
type AppendableFile ¶
type AppendableFile struct {
// contains filtered or unexported fields
}
func (*AppendableFile) Append ¶
func (aof *AppendableFile) Append(bs []byte) (off int64, n int, err error)
func (*AppendableFile) Close ¶
func (aof *AppendableFile) Close() error
func (*AppendableFile) CompressionFormat ¶
func (aof *AppendableFile) CompressionFormat() int
func (*AppendableFile) CompressionLevel ¶
func (aof *AppendableFile) CompressionLevel() int
func (*AppendableFile) Copy ¶ added in v0.9.1
func (aof *AppendableFile) Copy(dstPath string) error
func (*AppendableFile) DiscardUpto ¶ added in v1.2.3
func (aof *AppendableFile) DiscardUpto(off int64) error
func (*AppendableFile) Flush ¶
func (aof *AppendableFile) Flush() error
func (*AppendableFile) Metadata ¶
func (aof *AppendableFile) Metadata() []byte
func (*AppendableFile) Offset ¶
func (aof *AppendableFile) Offset() int64
func (*AppendableFile) ReadAt ¶
func (aof *AppendableFile) ReadAt(bs []byte, off int64) (n int, err error)
func (*AppendableFile) SetOffset ¶
func (aof *AppendableFile) SetOffset(newOffset int64) error
func (*AppendableFile) Size ¶
func (aof *AppendableFile) Size() (int64, error)
func (*AppendableFile) SwitchToReadOnlyMode ¶ added in v1.3.2
func (aof *AppendableFile) SwitchToReadOnlyMode() error
func (*AppendableFile) Sync ¶
func (aof *AppendableFile) Sync() error
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() *Options