local

package
v0.0.0-...-d2d5cb9 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2018 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrBackupFileNotExist is returned when the file the backup was saved to does not exist anymore
	ErrBackupFileNotExist = errors.New("Backup file does not exist")
	// ErrBackupOriginalFileNotExist is returned when the original file of the backup does not exist
	ErrBackupOriginalFileNotExist = errors.New("Original file does not exist")
)

Functions

func NewMainConfigStorage

func NewMainConfigStorage(n agent.Nginx) storage.MainConfigStorage

NewMainConfigStorage stores the config in the file system configures a local nginx instance

func NewServerConfigStorage

func NewServerConfigStorage(n agent.Nginx) storage.ServerConfigStorage

NewServerConfigStorage stores the config in the file system configures a local nginx instance

Types

type Backup

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

Backup represents the backup of a file

func CreateBackup

func CreateBackup(path string) (backup *Backup, err error)

CreateBackup creates a new backup

func (*Backup) Delete

func (b *Backup) Delete() error

Delete deletes the backup file

func (*Backup) Restore

func (b *Backup) Restore() (err error)

Restore restores the original file from the backup

type BackupFactory

type BackupFactory func(filename string) (*Backup, error)

BackupFactory creates backups

type Transaction

type Transaction interface {
	Delete(filename string) error
	Update(filename, content string) error
	Rollback()
	Apply()
}

Transaction records file changes and is able to roll them back

func CreateTransaction

func CreateTransaction() Transaction

CreateTransaction creates a new transaction instance

type TransactionFactory

type TransactionFactory func() Transaction

TransactionFactory creates new transactions

Jump to

Keyboard shortcuts

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