Documentation ¶
Index ¶
- Constants
- func CompareConfigs(received, desired []byte, configType FileType) error
- func GetBsonMap(pathToFile string) (map[string]interface{}, error)
- func GetMapFromBytes(content []byte, configType FileType) (map[string]interface{}, error)
- func GetSerializedRevertStepsDir() (string, error)
- func MoveFile(source string, destination string) error
- func SaveBsonMap(toSave map[string]interface{}, pathToFile string) error
- type DirEntry
- type FileInfo
- type FilePrototype
- func (p *FilePrototype) AddNewLayer(layer PrototypeLayer, isOriginal bool) error
- func (p *FilePrototype) CreateLayer(content []byte, options []byte, isOptional bool) (PrototypeLayer, error)
- func (p *FilePrototype) Read(vrctPrefix string, realPath string) error
- func (p *FilePrototype) Save() error
- func (p *FilePrototype) SimulateFile() ([]byte, error)
- type FileType
- type PrototypeLayer
- type RevertStep
- type RevertSteps
- func (r *RevertSteps) Apply(revertFn func(rule Rule) error) error
- func (r *RevertSteps) BackupOldContent(path string) error
- func (r *RevertSteps) DeleteRuntimeTemp() error
- func (r *RevertSteps) Deserialize(revertNum int) error
- func (r *RevertSteps) RemoveDirAll(path string)
- func (r *RevertSteps) RemoveFile(path string)
- func (r *RevertSteps) Serialize(rulesToRevert []Rule) (int, error)
- type Rule
- type VRCTFs
- func (v *VRCTFs) Apply(rulesHistory []Rule, serializeRevertSteps bool) (int, error)
- func (v *VRCTFs) Copy(from, to string) error
- func (v *VRCTFs) CreateConfig(filePath string, content []byte, optionalKeys []byte, isOptional bool, ...) error
- func (v *VRCTFs) CreateFile(filePath string, content []byte, isOptional bool) error
- func (v *VRCTFs) DeleteRuntimeTemp() error
- func (v *VRCTFs) ReadDir(dirPath string) ([]os.DirEntry, error)
- func (v *VRCTFs) ReadFile(filePath string) ([]byte, error)
- func (v *VRCTFs) Revert(fn func(rule Rule) error) error
- func (v *VRCTFs) Stat(filePath string) (os.FileInfo, error)
- func (v *VRCTFs) UpdateConfig(filePath string, content []byte, optionalKeys []byte, isOptional bool, ...) error
Constants ¶
View Source
const VirtualFilePostfix = ".prototype.bson"
View Source
const VirtualFsPathPrefix = "/tmp/spito-vrct/fs"
Variables ¶
This section is empty.
Functions ¶
func CompareConfigs ¶
func GetBsonMap ¶
func GetMapFromBytes ¶
func SaveBsonMap ¶
Types ¶
type DirEntry ¶
type FilePrototype ¶
type FilePrototype struct { Layers []PrototypeLayer RealFileExists bool FileType FileType OriginalFileIncluded bool Path string `bson:"-"` Name string `bson:"-"` }
func (*FilePrototype) AddNewLayer ¶
func (p *FilePrototype) AddNewLayer(layer PrototypeLayer, isOriginal bool) error
func (*FilePrototype) CreateLayer ¶
func (p *FilePrototype) CreateLayer(content []byte, options []byte, isOptional bool) (PrototypeLayer, error)
func (*FilePrototype) Save ¶
func (p *FilePrototype) Save() error
func (*FilePrototype) SimulateFile ¶
func (p *FilePrototype) SimulateFile() ([]byte, error)
type PrototypeLayer ¶
type PrototypeLayer struct { // If ContentPath is specified and file exists in real fs, real file will be later overridden by this content // (We don't store content as string in order to make bson lightweight and fast accessible) ContentPath string `bson:",omitempty"` OptionsPath string `bson:",omitempty"` IsOptional bool }
func (*PrototypeLayer) GetContent ¶
func (layer *PrototypeLayer) GetContent() ([]byte, error)
func (*PrototypeLayer) SetContent ¶
func (layer *PrototypeLayer) SetContent(content []byte) error
type RevertStep ¶
type RevertStep struct { Path string `bson:"Path"` Action int `bson:"Action"` // OldContentPath field is optional OldContentPath string `bson:"OldContentPath"` }
func (*RevertStep) Apply ¶
func (r *RevertStep) Apply() error
type RevertSteps ¶
type RevertSteps struct { Steps []RevertStep `bson:"Steps"` RulesToRevert []Rule `bson:"RulesToRevert"` RevertTempDir string `bson:"-"` }
func NewRevertSteps ¶
func NewRevertSteps() (RevertSteps, error)
func (*RevertSteps) BackupOldContent ¶
func (r *RevertSteps) BackupOldContent(path string) error
func (*RevertSteps) DeleteRuntimeTemp ¶
func (r *RevertSteps) DeleteRuntimeTemp() error
func (*RevertSteps) Deserialize ¶
func (r *RevertSteps) Deserialize(revertNum int) error
func (*RevertSteps) RemoveDirAll ¶
func (r *RevertSteps) RemoveDirAll(path string)
func (*RevertSteps) RemoveFile ¶
func (r *RevertSteps) RemoveFile(path string)
type VRCTFs ¶
type VRCTFs struct {
// contains filtered or unexported fields
}
func (*VRCTFs) Apply ¶
Apply first parameter takes array of identifiers returns revertNumber if serializeRevertSteps is true
func (*VRCTFs) CreateConfig ¶
func (v *VRCTFs) CreateConfig(filePath string, content []byte, optionalKeys []byte, isOptional bool, fileType FileType) error
CreateConfig function creating or updating configuration file
Arguments:
filePath - Path to file content - content of file optionalKeys - json or yaml document describing which key in config is optional isOptional - default option in configs / is able to merge in text files fileType - given 0 - text file, otherwise config specified in file_type.go
func (*VRCTFs) CreateFile ¶
CreateFile function creating file
Arguments:
filePath - Path to file content - content of file isOptional - default option in configs / is able to merge in text files
func (*VRCTFs) DeleteRuntimeTemp ¶
Click to show internal directories.
Click to hide internal directories.