ndctl

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: Apache-2.0 Imports: 7 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bus

type Bus C.struct_ndctl_bus

Bus go wrapper for ndctl_bus

func (*Bus) ActiveRegions

func (b *Bus) ActiveRegions() []*Region

ActiveRegions returns all active regions in the bus

func (*Bus) AllRegions

func (b *Bus) AllRegions() []*Region

AllRegions returns all regions in the bus including disabled regions

func (*Bus) DeviceName

func (b *Bus) DeviceName() string

DeviceName returns bus device name

func (*Bus) Dimms

func (b *Bus) Dimms() []*Dimm

Dimms returns dimms provided by the bus

func (*Bus) GetRegionByPhysicalAddress

func (b *Bus) GetRegionByPhysicalAddress(address uint64) *Region

GetRegionByPhysicalAddress Find region by physical address

func (*Bus) MarshalJSON

func (b *Bus) MarshalJSON() ([]byte, error)

MarshalJSON returns the encoded value of bus

func (*Bus) Provider

func (b *Bus) Provider() string

Provider returns bus provider

type Context

type Context C.struct_ndctl_ctx

Context go wrapper for ndctl context

func NewContext

func NewContext() (*Context, error)

NewContext Initializes new context

func (*Context) CreateNamespace

func (ctx *Context) CreateNamespace(opts CreateNamespaceOpts) (*Namespace, error)

CreateNamespace create new namespace with given opts

func (*Context) DestroyNamespaceByName

func (ctx *Context) DestroyNamespaceByName(name string) error

DestroyNamespaceByName deletes namespace with given name

func (*Context) Free

func (ctx *Context) Free()

Free destroy context

func (*Context) GetActiveNamespaces

func (ctx *Context) GetActiveNamespaces() []*Namespace

GetActiveNamespaces returns list of all active namespaces in all regions

func (*Context) GetAllNamespaces

func (ctx *Context) GetAllNamespaces() []*Namespace

GetAllNamespaces returns list of all namespaces in all regions including idle namespaces

func (*Context) GetBuses

func (ctx *Context) GetBuses() []*Bus

GetBuses returns available buses

func (*Context) GetNamespaceByName

func (ctx *Context) GetNamespaceByName(name string) (*Namespace, error)

GetNamespaceByName gets namespace details for given name

func (*Context) IsSpaceAvailable

func (ctx *Context) IsSpaceAvailable(size uint64) bool

IsSpaceAvailable checks if a region available with given free size

type CreateNamespaceOpts

type CreateNamespaceOpts struct {
	Name       string
	Size       uint64
	SectorSize uint64
	Align      uint64
	Type       NamespaceType
	Mode       NamespaceMode
	Location   MapLocation
}

CreateNamespaceOpts options to create a namespace

type Dimm

type Dimm C.struct_ndctl_dimm

Dimm go wrapper for ndctl_dimm

func (*Dimm) Active

func (d *Dimm) Active() bool

Active returns if the the device is active

func (*Dimm) DeviceName

func (d *Dimm) DeviceName() string

DeviceName returns dimm device name

func (*Dimm) Enabled

func (d *Dimm) Enabled() bool

Enabled returns if the dimm is enabled

func (*Dimm) Handle

func (d *Dimm) Handle() int16

Handle returns dimm handle

func (*Dimm) ID

func (d *Dimm) ID() string

ID returns unique dimm id

func (*Dimm) MarshalJSON

func (d *Dimm) MarshalJSON() ([]byte, error)

MarshalJSON returns the encoding of dimm

func (*Dimm) PhysicalID

func (d *Dimm) PhysicalID() int

PhysicalID returns dimm physical id

type MapLocation

type MapLocation string
const (
	MemoryMap MapLocation = "mem" // RAM
	DeviceMap MapLocation = "dev" // Block Device
	NoneMap   MapLocation = "none"
)

type Mapping

type Mapping C.struct_ndctl_mapping

Mapping go wrapper for ndctl_mapping

func (*Mapping) Dimm

func (m *Mapping) Dimm() *Dimm

Dimm get associated Dimm

func (*Mapping) Length

func (m *Mapping) Length() uint64

Length returns mapping length

func (*Mapping) MarshalJSON

func (m *Mapping) MarshalJSON() ([]byte, error)

MarshalJSON returns json encoding of the mapping

func (*Mapping) Offset

func (m *Mapping) Offset() uint64

Offset returns offset within the region

func (*Mapping) Position

func (m *Mapping) Position() int

Position returns mapping position

func (*Mapping) Region

func (m *Mapping) Region() *Region

Region get associated Region

type Namespace

type Namespace C.struct_ndctl_namespace

Namespace go wrapper for ndctl_namespace

func (*Namespace) Active

func (ns *Namespace) Active() bool

Active return if namespace is active

func (*Namespace) BlockDeviceName

func (ns *Namespace) BlockDeviceName() string

BlockDeviceName return namespace block device name

func (*Namespace) DeviceName

func (ns *Namespace) DeviceName() string

DeviceName returns namespace device name

func (*Namespace) Enable

func (ns *Namespace) Enable() error

func (*Namespace) Enabled

func (ns *Namespace) Enabled() bool

Enabled return if namespace is enabled

func (*Namespace) ID

func (ns *Namespace) ID() uint

ID returns namespace id

func (*Namespace) Location

func (ns *Namespace) Location() MapLocation

Location returns namespace mapping location

func (*Namespace) MarshalJSON

func (ns *Namespace) MarshalJSON() ([]byte, error)

MarshalJSON returns json encoding of namespace

func (*Namespace) Mode

func (ns *Namespace) Mode() NamespaceMode

Mode returns namespace mode

func (*Namespace) Name

func (ns *Namespace) Name() string

Name returns name of the namespace

func (*Namespace) Region

func (ns *Namespace) Region() *Region

Region returns reference to Region that this namespace is part of

func (*Namespace) SetAltName

func (ns *Namespace) SetAltName(name string) error

func (*Namespace) SetEnforceMode

func (ns *Namespace) SetEnforceMode(mode NamespaceMode) error

func (*Namespace) SetSectorSize

func (ns *Namespace) SetSectorSize(sectorSize uint64) error

func (*Namespace) SetSize

func (ns *Namespace) SetSize(size uint64) error

func (*Namespace) SetUUID

func (ns *Namespace) SetUUID(uid uuid.UUID) error

func (*Namespace) Size

func (ns *Namespace) Size() uint64

Size returns size of the namespace

func (*Namespace) Type

func (ns *Namespace) Type() NamespaceType

Type returns namespace type

func (*Namespace) UUID

func (ns *Namespace) UUID() uuid.UUID

UUID returns uuid of the namespace

type NamespaceMode

type NamespaceMode string

NamespaceMode represents mode of the namespace

const (
	DaxMode     NamespaceMode = "dax"   //DevDax
	FsdaxMode   NamespaceMode = "fsdax" //Memory
	RawMode     NamespaceMode = "raw"
	SectorMode  NamespaceMode = "sector"
	UnknownMode NamespaceMode = "unknown"
)

type NamespaceType

type NamespaceType string

NamespaceType type to represent namespace type

const (
	//PmemNamespace pmem type namespace
	PmemNamespace NamespaceType = "pmem"
	//BlockNamespace block type namespace
	BlockNamespace NamespaceType = "blk"
	//IoNamespace io type namespace
	IoNamespace NamespaceType = "io"
	//UnknownType unknown namespace
	UnknownType NamespaceType = "unknown"
)

type Region

type Region C.struct_ndctl_region

Region go wrapper for ndctl_region

func (*Region) ActiveNamespaces

func (r *Region) ActiveNamespaces() []*Namespace

ActiveNamespaces returns all active namespaces in the region

func (*Region) AllNamespaces

func (r *Region) AllNamespaces() []*Namespace

AllNamespaces returns all namespaces in the region

func (*Region) AvailableSize

func (r *Region) AvailableSize() uint64

AvailableSize returns size available in the region

func (*Region) Bus

func (r *Region) Bus() *Bus

Bus get associated bus

func (*Region) CreateNamespace

func (r *Region) CreateNamespace(opts CreateNamespaceOpts) (*Namespace, error)

func (*Region) DestroyNamespace

func (r *Region) DestroyNamespace(ns *Namespace, force bool) error

DestroyNamespace destroys the given namespace ns in the region

func (*Region) DeviceName

func (r *Region) DeviceName() string

DeviceName returns region name

func (*Region) Enabled

func (r *Region) Enabled() bool

func (*Region) ID

func (r *Region) ID() uint

ID returns region id

func (*Region) InterleaveWays added in v0.5.0

func (r *Region) InterleaveWays() uint64

func (*Region) Mappings

func (r *Region) Mappings() []*Mapping

Mappings return available mappings in the region

func (*Region) MarshalJSON

func (r *Region) MarshalJSON() ([]byte, error)

MarshalJSON returns json encoding of the region

func (*Region) MaxAvailableExtent

func (r *Region) MaxAvailableExtent() uint64

MaxAvailableExtent returns max available extent size in the region

func (*Region) Readonly

func (r *Region) Readonly() bool

func (*Region) SeedNamespace

func (r *Region) SeedNamespace() *Namespace

func (*Region) Size

func (r *Region) Size() uint64

Size returns total size of the region

func (*Region) Type

func (r *Region) Type() RegionType

func (*Region) TypeName

func (r *Region) TypeName() string

TypeName returns region type

type RegionType

type RegionType string
const (
	PmemRegion    RegionType = "pmem" //C.ND_DEVICE_REGION_PMEM
	BlockRegion   RegionType = "blk"  //C.ND_DEVICE_REGION_BLK
	UnknownRegion RegionType = "unknown"
)

Jump to

Keyboard shortcuts

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