app

package
v0.0.0-...-883cb22 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2020 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SysconfigSaptuneFile = "/etc/sysconfig/saptune"
	TuneForSolutionsKey  = "TUNE_FOR_SOLUTIONS"
	TuneForNotesKey      = "TUNE_FOR_NOTES"
	NoteApplyOrderKey    = "NOTE_APPLY_ORDER"
)

define saptunes main configuration file and variables

View Source
const SaptuneStateDir = "/var/lib/saptune/saved_state"

SaptuneStateDir defines saptunes saved state directory

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	SysconfigPrefix  string
	AllNotes         map[string]note.Note         // all notes
	AllSolutions     map[string]solution.Solution // all solutions
	TuneForSolutions []string                     // list of solution names to tune, must always be sorted in ascending order.
	TuneForNotes     []string                     // list of additional notes to tune, must always be sorted in ascending order.
	NoteApplyOrder   []string                     // list of notes in applied order. Do NOT sort.
	State            *State                       // examine and manage serialised notes.
}

App defines the application configuration and serialised state information.

func InitialiseApp

func InitialiseApp(sysconfigPrefix, stateDirPrefix string, allNotes map[string]note.Note, allSolutions map[string]solution.Solution) (app *App)

InitialiseApp load application configuration. Panic on error.

func (*App) GetNoteByID

func (app *App) GetNoteByID(id string) (note.Note, error)

GetNoteByID return the note corresponding to the number, or an error if the note does not exist.

func (*App) GetSolutionByName

func (app *App) GetSolutionByName(name string) (solution.Solution, error)

GetSolutionByName return the solution corresponding to the name, or an error if it does not exist.

func (*App) GetSortedSolutionEnabledNotes

func (app *App) GetSortedSolutionEnabledNotes() (allNoteIDs []string)

GetSortedSolutionEnabledNotes returns the number of all solution-enabled SAP notes, sorted.

func (*App) IsNoteApplied

func (app *App) IsNoteApplied(noteID string) (string, bool)

IsNoteApplied checks, if a note is applied or not return true, if note is already applied return false, if not is NOT applied

func (*App) NoteSanityCheck

func (app *App) NoteSanityCheck() error

NoteSanityCheck checks, if for all notes listed in NoteApplyOrder and TuneForNotes a note definition file exists. if not, remove the NoteID from the variables, save the new config and inform the user

func (*App) PositionInNoteApplyOrder

func (app *App) PositionInNoteApplyOrder(noteID string) int

PositionInNoteApplyOrder returns the position of the note within the slice. for a given noteID get the position in the slice NoteApplyOrder do not sort the slice

func (*App) PrintNoteApplyOrder

func (app *App) PrintNoteApplyOrder(writer io.Writer)

PrintNoteApplyOrder prints out the order of the currently applied notes

func (*App) RevertAll

func (app *App) RevertAll(permanent bool) error

RevertAll revert all tuned parameters (both solutions and additional notes), and clear stored states, but NOT NoteApplyOrder.

func (*App) RevertNote

func (app *App) RevertNote(noteID string, permanent bool) error

RevertNote revert parameters tuned by the note and clear its stored states.

func (*App) RevertSolution

func (app *App) RevertSolution(solName string) error

RevertSolution permanently revert notes tuned by the solution and clear their stored states.

func (*App) SaveConfig

func (app *App) SaveConfig() error

SaveConfig save configuration to file /etc/sysconfig/saptune.

func (*App) TuneAll

func (app *App) TuneAll() error

TuneAll tune for all currently enabled solutions and notes.

func (*App) TuneNote

func (app *App) TuneNote(noteID string) error

TuneNote apply tuning for a note. If the note is not yet covered by one of the enabled solutions, the note number will be added into the list of additional notes.

func (*App) TuneSolution

func (app *App) TuneSolution(solName string) (removedExplicitNotes []string, err error)

TuneSolution apply tuning for a solution. If the solution is not yet enabled, the name will be added into the list of tuned solution names. If the solution covers any of the additional notes, those notes will be removed.

func (*App) VerifyAll

func (app *App) VerifyAll() (unsatisfiedNotes []string, comparisons map[string]map[string]note.FieldComparison, err error)

VerifyAll inspect the system and verify all parameters against all enabled notes/solutions. The note comparison results will always contain all fields from all notes.

func (*App) VerifyNote

func (app *App) VerifyNote(noteID string) (conforming bool, comparisons map[string]note.FieldComparison, valApplyList []string, err error)

VerifyNote inspect the system and verify that all parameters conform to the note's guidelines. The note comparison results will always contain all fields, no matter the note is currently conforming or not.

func (*App) VerifySolution

func (app *App) VerifySolution(solName string) (unsatisfiedNotes []string, comparisons map[string]map[string]note.FieldComparison, err error)

VerifySolution inspect the system and verify that all parameters conform to all of the notes associated to the solution. The note comparison results will always contain all fields from all notes.

type State

type State struct {
	StateDirPrefix string
}

State stores and manages serialised note states.

func (*State) GetPathToNote

func (state *State) GetPathToNote(noteID string) string

GetPathToNote returns path to the serialised note state file.

func (*State) List

func (state *State) List() (ret []string, err error)

List all stored note states. Return note numbers.

func (*State) Remove

func (state *State) Remove(noteID string) error

Remove a serialised state file.

func (*State) Retrieve

func (state *State) Retrieve(noteID string, dest interface{}) error

Retrieve deserialises a SAP note into the destination pointer. The destination must be a pointer.

func (*State) Store

func (state *State) Store(noteID string, obj note.Note, overwriteExisting bool) error

Store creates a file under state directory with the object serialised into JSON. Overwrite existing file if there is any.

Jump to

Keyboard shortcuts

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