common

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CopyWithContext

func CopyWithContext(ctx context.Context, dst io.Writer, src io.Reader) (int64, error)

CopyWithContext copies data from src to dst with context cancellation support

func GetDownloadedVersions

func GetDownloadedVersions(baseDir, binaryName string, logger *logrus.Entry) ([]string, error)

GetDownloadedVersions returns list of locally downloaded versions by scanning the base directory for version directories containing the specified binary

func MoveFile

func MoveFile(logger *logrus.Entry, src, dst string) error

MoveFile moves a file from src to dst, handling cross-device links

func VerifyChecksum

func VerifyChecksum(logger *logrus.Entry, filePath, expectedSHA256 string) error

VerifyChecksum verifies the SHA256 checksum of a file

Types

type ArchiveBinary

type ArchiveBinary struct {
	Arch        string `json:"arch"`
	DownloadURL string `json:"download_url"`
	SHA256      string `json:"sha256"`
}

ArchiveBinary represents a binary download info

type ArchiveRelease

type ArchiveRelease struct {
	Version  string          `json:"version"`
	Date     time.Time       `json:"date"`
	Binaries []ArchiveBinary `json:"binaries"`
}

ArchiveRelease represents a single release from the archive API

type PermissionManager

type PermissionManager struct {
	BaseDir  string
	DirPerm  os.FileMode
	FilePerm os.FileMode
	Logger   *logrus.Entry
}

PermissionManager manages directory and file permissions for binary packages

func NewPermissionManager

func NewPermissionManager(baseDir string, dirPerm, filePerm os.FileMode, logger *logrus.Entry) *PermissionManager

NewPermissionManager creates a new PermissionManager with the given configuration

func (*PermissionManager) CreateVersionDirectory

func (pm *PermissionManager) CreateVersionDirectory(version string) (string, error)

CreateVersionDirectory creates directory structure for a version

func (*PermissionManager) EnsureBaseDirectory

func (pm *PermissionManager) EnsureBaseDirectory() error

EnsureBaseDirectory creates the base directory if it doesn't exist

func (*PermissionManager) SetBinaryPermissions

func (pm *PermissionManager) SetBinaryPermissions(binaryPath string) error

SetBinaryPermissions sets proper permissions for a binary file

Jump to

Keyboard shortcuts

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