bufstate

package
v0.0.0-...-6f1d431 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const GlobalStateFileName = "state.json"
View Source
const ModStateFileName = "state.json"
View Source
const SyncRoot = "modules/sync"

Variables

This section is empty.

Functions

This section is empty.

Types

type ReadWriter

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

func NewReadWriter

func NewReadWriter() (*ReadWriter, error)

func (*ReadWriter) AppendModuleReference

func (rw *ReadWriter) AppendModuleReference(
	rootSyncDir string,
	ownerName string,
	repoName string,
	reference string,
	digest string,
) error

AppendModuleReference appends a reference-digest pair at the end of the module state, and updates the module's latest reference in the global state. It assumes the structure of the sync dir is `root-sync-dir/owner-name/repo-name/state.json` for module state file, and `root-sync-dir/state.json` for global state file.

func (*ReadWriter) ReadGlobalState

func (rw *ReadWriter) ReadGlobalState(reader io.ReadCloser) (_ *statev1alpha1.GlobalState, retErr error)

ReadGlobalState reads a JSON encoded GlobalState from the given reader before closing it.

func (*ReadWriter) ReadModStateFile

func (rw *ReadWriter) ReadModStateFile(readCloser io.ReadCloser) (_ *statev1alpha1.ModuleState, retErr error)

ReadModStateFile reads a JSON encoded ModuleState from the given reader before closing it.

func (*ReadWriter) WriteGlobalState

func (rw *ReadWriter) WriteGlobalState(writer io.WriteCloser, globalState *statev1alpha1.GlobalState) (retErr error)

WriteGlobalState takes a global state and writes it to the given writer before closing it.

func (*ReadWriter) WriteModStateFile

func (rw *ReadWriter) WriteModStateFile(writeCloser io.WriteCloser, moduleState *statev1alpha1.ModuleState) (retErr error)

WriteModStateFile takes a module state and writes it to the given writer before closing it.

Jump to

Keyboard shortcuts

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