migrate

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package migrate moves the state of the old flat layout (0.4 and before: <id>.txt, .<id>.state and so on, all in the state folder) into one folder per session. `sitrep setup` runs it after it has installed the program, and the user can run it with `sitrep migrate`. It is never called from a hook, and it is safe to run again and to stop at any point.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pending

func Pending(s state.Store) int

Pending counts the files of the old layout that are still in the root of the state folder, for a note that tells the user to migrate.

Types

type Result

type Result struct {
	Lines   []string
	Moved   int
	Merged  int
	Left    int
	Deleted int
	Errors  int
}

Result says what a run did, one line per file, and how many.

func Run

func Run(s state.Store, dry bool) Result

Run moves every file of the old layout it finds. A file is moved by a hard link into the session's folder and removal of the old name, so nothing is ever overwritten (a rename would replace a file a new hook wrote a moment ago), the modification time that dates a state is kept, and a run that is stopped halfway is finished by the next one. A queue that exists in both places is merged, the old items first. Any other file whose destination exists stays where it is and is reported. The notes of a session move last, because a session exists only when its notes do: one that is moved in part is not listed in part. With dry nothing changes.

Jump to

Keyboard shortcuts

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