sstore

package module
v0.0.0-...-f357b34 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 19 Imported by: 0

README

sstore

stream store

Documentation

Overview

Copyright 2020-2026 The sstore Authors 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

View Source
const KB = 1024
View Source
const MB = 1024 * 1024
View Source
const (
	WalExt = ".log"
)

Variables

View Source
var (
	ErrWal = errors.New("wal error")
)

Functions

This section is empty.

Types

type Options

type Options struct {
	Path                          string `json:"path"`
	FilesDir                      string `json:"files_dir"`
	WalDir                        string `json:"wal_dir"`
	SegmentDir                    string `json:"segment_dir"`
	MaxSegmentCount               int    `json:"max_segment_count"`
	BlockSize                     int64  `json:"block_size"`
	MaxMStreamTableSize           int64  `json:"max_mStream_table_size"`
	MaxImmutableMStreamTableCount int    `json:"max_immutable_mStream_table_count"`
	EntryQueueCap                 int    `json:"entry_queue_cap"`
	MaxWalSize                    int64  `json:"max_wal_size"`
}

func DefaultOptions

func DefaultOptions(Path string) Options

func (Options) WithBlockSize

func (opt Options) WithBlockSize(val int64) Options

WithBlockSize

func (Options) WithEntryQueueCap

func (opt Options) WithEntryQueueCap(val int) Options

EntryQueueCap

func (Options) WithFilesDir

func (opt Options) WithFilesDir(val string) Options

WithFilesDir

func (Options) WithMaxImmutableMStreamTableCount

func (opt Options) WithMaxImmutableMStreamTableCount(val int) Options

MaxImmutableMStreamTableCount

func (Options) WithMaxMStreamTableSize

func (opt Options) WithMaxMStreamTableSize(val int64) Options

WithMaxMStreamTableSize

func (Options) WithMaxSegmentCount

func (opt Options) WithMaxSegmentCount(val int) Options

WithMaxSegmentCount

func (Options) WithMaxWalSize

func (opt Options) WithMaxWalSize(val int64) Options

WithMaxWalSize

func (Options) WithSegmentDir

func (opt Options) WithSegmentDir(val string) Options

WithSegmentDir

func (Options) WithWalPath

func (opt Options) WithWalPath(val string) Options

WithWalPath

type SStore

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

func Open

func Open(options Options) (*SStore, error)

func (*SStore) Append

func (sstore *SStore) Append(name string, data []byte) error

Append append the data to end of the stream

func (*SStore) AsyncAppend

func (sstore *SStore) AsyncAppend(name string, data []byte, cb func(err error))

AsyncAppend async append the data to end of the stream

func (*SStore) Begin

func (sstore *SStore) Begin(name string) (int64, bool)

base return the begin of stream. return 0,false when the stream no exist

func (*SStore) Close

func (sstore *SStore) Close() error

Close sstore

func (*SStore) End

func (sstore *SStore) End(name string) (int64, bool)

size return the end of stream. return _,false when the stream no exist

func (*SStore) Exist

func (sstore *SStore) Exist(name string) bool

Exist return true if the stream exist otherwise return false

func (*SStore) GC

func (sstore *SStore) GC() error

func (*SStore) Options

func (sstore *SStore) Options() Options

func (*SStore) ReadSeeker

func (sstore *SStore) ReadSeeker(name string) io.ReadSeeker

ReadSeeker create ReadSeeker of the stream

func (*SStore) Watcher

func (sstore *SStore) Watcher(name string) Watcher

Watcher create watcher of the stream

type Watcher

type Watcher interface {
	//Watch return chan for watching the end of stream
	Watch() chan int64
	Close()
}

Jump to

Keyboard shortcuts

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