rfile

package
v0.0.0-...-2987df4 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2019 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InitSFTP

func InitSFTP(host string, sshUser string, key string) (*sftp.Client, *ssh.Client, error)

InitSFTP init sftp session

func IsFile

func IsFile(file string) bool

IsFile returns true if the file doesn't exist

Types

type File

type File struct {
	Name     string
	FileType string
	// contains filtered or unexported fields
}

File structure used to select nmon files to import

func New

func New(sftp *sftp.Client, l *logrus.Logger, name string) *File

New Create a RemoteFile

func (*File) Content

func (rf *File) Content() ([]string, int64)

Content returns the nmon files content from the current postion until the last writted line

func (*File) ContentUntilMatch

func (rf *File) ContentUntilMatch(regex *regexp.Regexp) ([]string, int64, error)

ContentUntilMatch returns the nmon files content from the current position until one line match regexp

func (*File) End

func (rf *File) End() error

End close RemoteFile

func (*File) GetRemoteReader

func (rf *File) GetRemoteReader() (*RemoteFileReader, error)

GetRemoteReader open an nmon file based on file extension and provides a bufio Reader

func (*File) Init

func (rf *File) Init()

Init Initialice File Reader

func (*File) SetPosition

func (rf *File) SetPosition(newpos int64) (int64, error)

SetPosition set file current position from the beggining

type RemoteFileReader

type RemoteFileReader struct {
	*sftp.File
	*bufio.Reader
}

RemoteFileReader struct for remote files

type SSHConfig

type SSHConfig struct {
	User string
	Key  string
}

SSHConfig contains SSH parameters

Jump to

Keyboard shortcuts

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