storage

package
v0.0.0-...-8a3301c Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2017 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Copyright © 2017 sosozhuang <sosozhuang@163.com>

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 © 2017 sosozhuang <sosozhuang@163.com>

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 © 2017 sosozhuang <sosozhuang@163.com>

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 © 2017 sosozhuang <sosozhuang@163.com>

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 © 2017 sosozhuang <sosozhuang@163.com>

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

This section is empty.

Variables

View Source
var (
	ErrNotFound = errors.New("storage: value not found")
)

Functions

This section is empty.

Types

type KeyValueStore

type KeyValueStore interface {
	Get(string) (string, error)
	Set(string, string) error
	Delete(string) error
	Close()
	comm.StateMachine
}

func NewKeyValueStore

func NewKeyValueStore(proposer comm.Proposer, dir string) (KeyValueStore, error)

type MultiGroupStorage

type MultiGroupStorage interface {
	Open(context.Context, <-chan struct{}) error
	Close()
	GetStorage(uint16) Storage
}

func NewDiskStorage

func NewDiskStorage(cfg StorageConfig) (MultiGroupStorage, error)

type Storage

type Storage interface {
	GetDir() string
	Recreate() error
	Get(uint64) ([]byte, error)
	Set(uint64, []byte) error
	Delete(uint64) error
	ForceDelete(uint64) error
	GetMaxInstanceID() (uint64, error)
	SetMinChosenInstanceID(uint64) error
	GetMinChosenInstanceID() (uint64, error)
	SetClusterInfo(*comm.ClusterInfo) error
	GetClusterInfo() (*comm.ClusterInfo, error)
	SetLeaderInfo(*comm.LeaderInfo) error
	GetLeaderInfo() (*comm.LeaderInfo, error)
	GetMaxInstanceIDFileID() (uint64, []byte, error)
	RebuildOneIndex(uint64, []byte) error
	// contains filtered or unexported methods
}

type StorageConfig

type StorageConfig struct {
	GroupCount int
	DataDir    string
	Type       StorageType
	Sync       bool
	SyncPeriod time.Duration
	SyncCount  int
	DisableWAL bool
}

type StorageType

type StorageType uint
const (
	RocksDB StorageType = iota
	LevelDB
)

func ParseStorageType

func ParseStorageType(s string) (StorageType, error)

Jump to

Keyboard shortcuts

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