filesnapshot

package
v0.0.0-...-9474aff Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2022 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Overview

Package filesnapshot provides functions that store/restore the snapshot (i.e. the content) of important files during integration test.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Snapshot

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

Snapshot mentions the lookup table from the filename to the corresponding stored snapshot, and it supports the operations that are defined below.

func NewSnapshot

func NewSnapshot() *Snapshot

NewSnapshot creates a new Snapshot of which lookup table is initialized.

func (*Snapshot) Pop

func (s *Snapshot) Pop(filename string) error

Pop restores and the file content and delete the snapshot for restoration as well.

func (*Snapshot) Remove

func (s *Snapshot) Remove(filename string)

Remove removes the entry of filename from the snapshot lookup table; if the snapshot doesn't exist, performs no-ops.

func (*Snapshot) Restore

func (s *Snapshot) Restore(filename string) error

Restore restores the snapshot of "filename". Note that the snapshot entry is not removed after the operation.

func (*Snapshot) Save

func (s *Snapshot) Save(filename string) error

Save reads the snapshot of filename, and stores it associated with the filename. If the snapshot is been saved before, overrides it.

func (*Snapshot) Stash

func (s *Snapshot) Stash(filename string) error

Stash stores the snapshot and delete the file.

Jump to

Keyboard shortcuts

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