device

package
v0.0.0-...-ded4e1a Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2020 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Overview

* Copyright (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (c) 2015-2018 Nexenta Systems, Inc. * * This file is part of EdgeFS Project * (see https://github.com/Nexenta/edgefs). * * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you 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 (
	FaultIDMain = iota
	FaultIDWAL
	FaultIDOffload
	FaultIDMaintenance
	FaultIDExternal
	FaultIDTotal
)
View Source
const (
	RtrdConfigPath string = "/etc/ccow/rt-rd.json"
)

Variables

View Source
var (
	DeviceCommand = &cobra.Command{
		Use:   "device",
		Short: "Devices management tools",
		Long:  "Devices management tools",
	}
	IsRTRD bool = true
)

Functions

func GetRTDevices

func GetRTDevices(path string) ([]config.RTDevice, error)

func WriteMetaloc

func WriteMetaloc(path string, meta *DiskMetaloc) error

Types

type DiskMetaloc

type DiskMetaloc struct {
	Timestamp uint64 `json:"created-timestamp"`
	// Plevel: number of shards per disk
	Plevel int `json:"plevel"`
	// main disk name, e.g. scsi-35000c500842a615b
	Device string `json:"device"`
	// Index of a the first journal partition
	FirstJournalPart int `json:"jpart"`
	//journal name, e.g. ata-SanDisk_SD6SB2M512G1022I_140751401308
	Journal string `json:"journal"`
	// mdoffload partition, e.g. ata-SanDisk_SD6SB2M512G1022I_140751401308-part10
	Mdoffload string `json:"offload"`
	// The previous device name. Used for disk replacement
	Oldname string `json:"oldname"`
	// EdgeFS' disk ID
	VdevID string `json:"vdevid"`
	// RTRD version
	Version int `json:"version"`
	// Mask of metadata types situated on the mdoffload SSD partition
	Metamask int `json:"metamask"`
	// bcache enable (1) or disable (0)
	Bcache int `json:"bcache"`
	// write-ahead load enabled(1) or disabled(0)
	Wal int `json:"wal"`
	// LMDB environment's page size, main partitions
	Psize uint64 `json:"psize"`
	// LMDB environment's page size, mdoffload partition
	Mdpsize uint64 `json:"mdpsize"`
	// An array of faults signature. Each fault's handler has to add
	//there an entry. The array is cleared when all faults are recovered.
	Faults []string `json:"faults"`
	// Current VDEV state, see the rdStateEnum
	State int `json:"state"`
	//Maintenance command ID. It can be the last performed activity
	//(state == rdstateOk) or pending/running one (state == rdstateMaintenance).
	MaintenanceCmd []string `json:"mtcmd"`
	//  PID of a process which is running the maintenance job.
	// 0 if no such a process,
	// Non-zero if there is (was) a process trying to execute the required
	// maintenance job
	Pid int `json:"pid"`
	//Number of times the maintenance was started,
	//but not finished (interrupted, crashed). Used to avoid
	//endless maintenance loop. The disk must be marked as faulted after a
	//number of attempts
	Retries int `json:"retries"`
}

func ReadMetaloc

func ReadMetaloc(path string) (DiskMetaloc, error)

func (*DiskMetaloc) DecodeMetalocFaults

func (meta *DiskMetaloc) DecodeMetalocFaults() ([]RdFaultEntry, error)

type LMDBDbiInfo

type LMDBDbiInfo struct {
	Name    string `json:"name"`
	Type    string `json:"type"`
	Entries uint64 `json:"entries"`
	Pages   uint64 `json:"pages"`
}

type LMDBEnv

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

func NewLMDBEnv

func NewLMDBEnv(path string) (env LMDBEnv, err error)

Create a new LMDBEnv instance @param path can be either raw disk path, either a symlink to a raw disk or a filesystem mount path

func (*LMDBEnv) AppendPostCommand

func (env *LMDBEnv) AppendPostCommand(cmd string)

func (*LMDBEnv) Capacity

func (env *LMDBEnv) Capacity() (uint64, error)

func (*LMDBEnv) CompactionCopyFrom

func (env *LMDBEnv) CompactionCopyFrom(scratch string) error

func (*LMDBEnv) CompactionCopyTo

func (env *LMDBEnv) CompactionCopyTo(scratch string) error

The first stage of compaction: copy from source to scratch area

func (*LMDBEnv) Copy

func (env *LMDBEnv) Copy(scratch *LMDBEnv, compactify bool) error

func (*LMDBEnv) DBICopy

func (env *LMDBEnv) DBICopy(scratch *LMDBEnv, dbiName string) error

func (*LMDBEnv) Format

func (env *LMDBEnv) Format() error

func (*LMDBEnv) ShowVerificationResults

func (env *LMDBEnv) ShowVerificationResults() (err error)

func (*LMDBEnv) UpdateInfo

func (env *LMDBEnv) UpdateInfo() error

func (*LMDBEnv) VerifyStructure

func (env *LMDBEnv) VerifyStructure(pol *dbiCheckPolicies, prevSnapshot bool, wal bool) (res structCheckResult, err error)

type LMDBEnvInfo

type LMDBEnvInfo struct {
	Psize        uint64        `json:"psize"`
	MapSize      uint64        `json:"mapsize"`
	MapUsed      uint64        `json:"mapused"`
	Entries      uint64        `json:"entries"`
	FreelistSize uint64        `json:"freelist_size"`
	Error        int           `json:"error"`
	ErrorString  string        `json:"errorstr"`
	Dbis         []LMDBDbiInfo `json:"dbi"`
}

func EnvInfo

func EnvInfo(kpath string) (info LMDBEnvInfo, err error)

Get the diskInfo structure retuned by a `dbi_util -i` call

func (*LMDBEnvInfo) Capacity

func (info *LMDBEnvInfo) Capacity() uint64

func (*LMDBEnvInfo) Used

func (info *LMDBEnvInfo) Used() uint64

type RdFaultEntry

type RdFaultEntry struct {
	Plevel int
	Id     int
	Code   int
}

func (*RdFaultEntry) String

func (e *RdFaultEntry) String() string

Jump to

Keyboard shortcuts

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