Documentation ¶
Overview ¶
Copyright 2021 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 2021 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 2021 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 2021 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 DefaultMultiFileAppendableHooks
- func (d *DefaultMultiFileAppendableHooks) OpenAppendable(options *singleapp.Options, appname string, needsWriteAccess bool) (appendable.Appendable, error)
- func (d *DefaultMultiFileAppendableHooks) OpenInitialAppendable(opts *Options, singleAppOpts *singleapp.Options) (app appendable.Appendable, appID int64, err error)
- type MultiFileAppendable
- func (mf *MultiFileAppendable) Append(bs []byte) (off int64, n int, err error)
- func (mf *MultiFileAppendable) Close() error
- func (mf *MultiFileAppendable) CompressionFormat() int
- func (mf *MultiFileAppendable) CompressionLevel() int
- func (mf *MultiFileAppendable) Copy(dstPath string) error
- func (mf *MultiFileAppendable) CurrApp() (appendable.Appendable, int64)
- func (mf *MultiFileAppendable) Flush() error
- func (mf *MultiFileAppendable) FlushWithId(appID int64) error
- func (mf *MultiFileAppendable) Metadata() []byte
- func (mf *MultiFileAppendable) Offset() int64
- func (mf *MultiFileAppendable) ReadAt(bs []byte, off int64) (int, error)
- func (mf *MultiFileAppendable) ReplaceCachedChunk(appID int64, app appendable.Appendable) (appendable.Appendable, error)
- func (mf *MultiFileAppendable) SetOffset(off int64) error
- func (mf *MultiFileAppendable) Size() (int64, error)
- func (mf *MultiFileAppendable) Sync() error
- type MultiFileAppendableHooks
- type Options
- func (opt *Options) GetFileExt() string
- func (opt *Options) GetFileMode() os.FileMode
- func (opts *Options) Valid() bool
- func (opt *Options) WithCompresionLevel(compressionLevel int) *Options
- func (opt *Options) WithCompressionFormat(compressionFormat int) *Options
- func (opt *Options) WithFileExt(fileExt string) *Options
- func (opt *Options) WithFileMode(fileMode os.FileMode) *Options
- func (opt *Options) WithFileSize(fileSize int) *Options
- func (opt *Options) WithMaxOpenedFiles(maxOpenedFiles int) *Options
- func (opt *Options) WithMetadata(metadata []byte) *Options
- func (opt *Options) WithReadOnly(readOnly bool) *Options
- func (opt *Options) WithSynced(synced bool) *Options
Constants ¶
const DefaultCompressionFormat = appendable.DefaultCompressionFormat
const DefaultCompressionLevel = appendable.DefaultCompressionLevel
const DefaultFileMode = os.FileMode(0755)
const DefaultFileSize = 1 << 26 // 64Mb
const DefaultMaxOpenedFiles = 10
Variables ¶
var ErrAlreadyClosed = errors.New("multi-appendable already closed")
var ErrIllegalArguments = errors.New("illegal arguments")
var ErrReadOnly = errors.New("cannot append when openned in read-only mode")
var ErrorPathIsNotADirectory = errors.New("path is not a directory")
Functions ¶
This section is empty.
Types ¶
type DefaultMultiFileAppendableHooks ¶ added in v1.0.5
type DefaultMultiFileAppendableHooks struct {
// contains filtered or unexported fields
}
func (*DefaultMultiFileAppendableHooks) OpenAppendable ¶ added in v1.0.5
func (d *DefaultMultiFileAppendableHooks) OpenAppendable(options *singleapp.Options, appname string, needsWriteAccess bool) (appendable.Appendable, error)
func (*DefaultMultiFileAppendableHooks) OpenInitialAppendable ¶ added in v1.0.5
func (d *DefaultMultiFileAppendableHooks) OpenInitialAppendable(opts *Options, singleAppOpts *singleapp.Options) (app appendable.Appendable, appID int64, err error)
type MultiFileAppendable ¶
type MultiFileAppendable struct {
// contains filtered or unexported fields
}
func OpenWithHooks ¶ added in v1.0.5
func OpenWithHooks(path string, hooks MultiFileAppendableHooks, opts *Options) (*MultiFileAppendable, error)
func (*MultiFileAppendable) Append ¶
func (mf *MultiFileAppendable) Append(bs []byte) (off int64, n int, err error)
func (*MultiFileAppendable) Close ¶
func (mf *MultiFileAppendable) Close() error
func (*MultiFileAppendable) CompressionFormat ¶
func (mf *MultiFileAppendable) CompressionFormat() int
func (*MultiFileAppendable) CompressionLevel ¶
func (mf *MultiFileAppendable) CompressionLevel() int
func (*MultiFileAppendable) Copy ¶ added in v0.9.1
func (mf *MultiFileAppendable) Copy(dstPath string) error
func (*MultiFileAppendable) CurrApp ¶ added in v1.0.5
func (mf *MultiFileAppendable) CurrApp() (appendable.Appendable, int64)
func (*MultiFileAppendable) Flush ¶
func (mf *MultiFileAppendable) Flush() error
func (*MultiFileAppendable) FlushWithId ¶ added in v1.0.5
func (mf *MultiFileAppendable) FlushWithId(appID int64) error
func (*MultiFileAppendable) Metadata ¶
func (mf *MultiFileAppendable) Metadata() []byte
func (*MultiFileAppendable) Offset ¶
func (mf *MultiFileAppendable) Offset() int64
func (*MultiFileAppendable) ReadAt ¶
func (mf *MultiFileAppendable) ReadAt(bs []byte, off int64) (int, error)
func (*MultiFileAppendable) ReplaceCachedChunk ¶ added in v1.0.5
func (mf *MultiFileAppendable) ReplaceCachedChunk(appID int64, app appendable.Appendable) (appendable.Appendable, error)
func (*MultiFileAppendable) SetOffset ¶
func (mf *MultiFileAppendable) SetOffset(off int64) error
func (*MultiFileAppendable) Size ¶
func (mf *MultiFileAppendable) Size() (int64, error)
func (*MultiFileAppendable) Sync ¶
func (mf *MultiFileAppendable) Sync() error
type MultiFileAppendableHooks ¶ added in v1.0.5
type MultiFileAppendableHooks interface { // Hook to open underlying appendable. // If needsWriteAccess is set to true, this appendable must be a single file appendable OpenAppendable(options *singleapp.Options, appname string, needsWriteAccess bool) (appendable.Appendable, error) // Hook to open the last underlying appendable that's available OpenInitialAppendable(opts *Options, singleAppOpts *singleapp.Options) (app appendable.Appendable, appID int64, err error) }
type Options ¶
type Options struct {
// contains filtered or unexported fields
}
func DefaultOptions ¶
func DefaultOptions() *Options