files

package
v3.0.0-...-55b81f4 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package files implements utility routines for gathering information about files and their contents.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertToMapOfFiles

func ConvertToMapOfFiles(files []*mpi.File) map[string]*mpi.File

ConvertToMapOfFiles converts a list of files to a map of files with the file name as the key

func FileMeta

func FileMeta(filePath string) (*mpi.FileMeta, error)

FileMeta returns a proto FileMeta struct from a given file path.

func FileMetaWithCertificate

func FileMetaWithCertificate(filePath string) (*mpi.FileMeta, error)

FileMetaWithCertificate returns a FileMeta struct with certificate metadata if applicable.

func FileMode

func FileMode(mode string) os.FileMode

func GenerateConfigVersion

func GenerateConfigVersion(fileSlice []*mpi.File) string

GenerateConfigVersion returns a unique config version for a set of files. The config version is calculated by joining the file hashes together and generating a unique ID.

func GenerateHash

func GenerateHash(b []byte) string

GenerateHash returns the hash value of a file's contents.

func Permissions

func Permissions(fileMode os.FileMode) string

Permissions returns a file's permissions as a string.

func RecvChunkedFile

func RecvChunkedFile(
	src grpc.ServerStreamingClient[v1.FileDataChunk],
	dst io.Writer,
) (header *v1.FileMeta, err error)

RecvChunkedFile receives [FileDataChunkContent]s from the stream and writes the file contents to the dst.

func SendChunkedFile

func SendChunkedFile(
	meta *v1.MessageMeta,
	header v1.FileDataChunk_Header,
	src io.Reader,
	dst grpc.ServerStreamingServer[v1.FileDataChunk],
) error

SendChunkedFile reads the src into [FileDataChunkContent]s, and sends a valid sequence of [FileDataChunk]s down the stream.

Types

This section is empty.

Jump to

Keyboard shortcuts

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