data

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Copyright 2022 Nethermind

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.

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.

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 (
	ErrMonitoringStackNotFound     = errors.New("monitoring stack not found")
	ErrInitializingMonitoringStack = errors.New("failed monitoring stack initialization")
	ErrReadingFile                 = errors.New("failed reading file")
	ErrWritingFile                 = errors.New("failed writing file")
	ErrStackNotInitialized         = errors.New("stack not initialized")
)

Functions

This section is empty.

Types

type DataDir

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

DataDir is the directory where all the data is stored.

func NewDataDir

func NewDataDir(path string, fs afero.Fs, locker locker.Locker) (*DataDir, error)

NewDataDir creates a new DataDir instance with the given path as root.

func NewDataDirDefault

func NewDataDirDefault(fs afero.Fs, locker locker.Locker) (*DataDir, error)

NewDataDirDefault creates a new DataDir instance with the default path as root. Default path is $XDG_DATA_HOME/.sedge or $HOME/.local/share/.sedge if $XDG_DATA_HOME is not set as defined in the XDG Base Directory Specification

func (*DataDir) MonitoringStack

func (d *DataDir) MonitoringStack() (*MonitoringStack, error)

MonitoringStack checks if a monitoring stack directory exists in the data directory. If the directory does not exist, it creates it and initializes a new MonitoringStack instance. If the directory exists, it simply returns a new MonitoringStack instance. It returns an error if there is any issue accessing or creating the directory, or initializing the MonitoringStack.

func (*DataDir) Path

func (d *DataDir) Path() string

Path returns the path of the data dir.

func (*DataDir) RemoveMonitoringStack

func (d *DataDir) RemoveMonitoringStack() error

RemoveMonitoringStack removes the monitoring stack directory from the data directory. It returns an error if there is any issue accessing or removing the directory.

type MonitoringStack

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

MonitoringStack represents the data stored about the monitoring stack

func (*MonitoringStack) Cleanup

func (m *MonitoringStack) Cleanup(force bool) (err error)

Cleanup removes the monitoring stack datadir. If force is true, it doesn't lock the monitoring stack.

func (*MonitoringStack) Create

func (m *MonitoringStack) Create(path string) (f afero.File, err error)

Create creates a new file in the monitoring stack at the given path.

func (*MonitoringStack) CreateDir

func (m *MonitoringStack) CreateDir(path string) (err error)

CreateDir creates a new directory in the monitoring stack at the given path. It creates all the parent directories if they don't exist. It does nothing if the directory already exists.

func (*MonitoringStack) Init

func (m *MonitoringStack) Init() error

Init initializes a new monitoring stack with the given path as root.

func (*MonitoringStack) Installed

func (m *MonitoringStack) Installed() (installed bool, err error)

Installed checks if the monitoring stack is installed.

func (*MonitoringStack) Path

func (m *MonitoringStack) Path() string

Path returns the path to the monitoring stack datadir.

func (*MonitoringStack) ReadFile

func (m *MonitoringStack) ReadFile(path string) (data []byte, err error)

ReadFile reads the file at the given path in the monitoring stack.

func (*MonitoringStack) Setup

func (m *MonitoringStack) Setup(env map[string]string, monitoringFs fs.FS) (err error)

Setup sets up the monitoring stack with the given environment variables and docker-compose_base.tmpl file.

func (*MonitoringStack) WriteFile

func (m *MonitoringStack) WriteFile(path string, data []byte) (err error)

WriteFile writes the given data to the file at the given path in the monitoring stack. It creates the file if it doesn't exist. It overwrites the file if it already exists.

Jump to

Keyboard shortcuts

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