Documentation ¶
Index ¶
- Constants
- func IgnoreDotGitPath(relPath string, info os.FileInfo) bool
- func ReleaseFileInfo(fi *FileInfo)
- func ReleaseFileInfoMap(m FileInfoMap)
- type FileInfo
- type FileInfoMap
- type FileStore
- func (s FileStore) AddDir(absPath string) (FileInfoMap, error)
- func (s FileStore) BuildDir(fim FileInfoMap, pkgDir string) error
- func (s FileStore) DirIsExist(pkgDir string) (bool, error)
- func (s FileStore) GetMetadataPath(pkgDir string) (string, error)
- func (s FileStore) Link(pkgDir, targetAbsPath string) error
- func (s FileStore) NewFileInfoMapFromDir(absPath string) (FileInfoMap, error)
- func (s FileStore) VerifyDir(fim FileInfoMap, absPath string) (bool, error)
- type FileStoreConfig
- type IgnoreFunc
- type Integrity
- func (it Integrity) GetRawHashString() (string, error)
- func (it Integrity) GetRawHashStringAndMod(i uint64) (string, string, error)
- func (it Integrity) GetRawHashStringAndMod256() (string, string, error)
- func (it Integrity) GetRawHashStringAndModFast(i uint64) (string, string, error)
- func (it Integrity) GetRawHashValue() ([]byte, error)
- func (it Integrity) GetType() string
- func (it Integrity) GetValue() string
- type Metadata
Constants ¶
View Source
const EmptyString = ""
View Source
const Separator = string(filepath.Separator)
Variables ¶
This section is empty.
Functions ¶
func ReleaseFileInfo ¶
func ReleaseFileInfo(fi *FileInfo)
func ReleaseFileInfoMap ¶
func ReleaseFileInfoMap(m FileInfoMap)
Types ¶
type FileInfo ¶
type FileInfo struct { //日期 CheckedAt int64 `json:"checked_at"` //完整性校验 Integrity Integrity `json:"integrity"` //权限 Mode int `json:"mode"` //文件大小 Size int64 `json:"size"` }
func AcquireFileInfo ¶
func AcquireFileInfo() *FileInfo
type FileInfoMap ¶
FileInfoMap 文件相对路径 文件信息
func AcquireFileInfoMap ¶
func AcquireFileInfoMap() FileInfoMap
func (FileInfoMap) Equal ¶
func (m FileInfoMap) Equal(fim FileInfoMap) bool
Equal 检测两个FileInfoMap是否相等
func (FileInfoMap) FileEqual ¶
func (m FileInfoMap) FileEqual(fim FileInfoMap) bool
FileEqual 仅检测两个FileInfoMap的文件是否相等
func (FileInfoMap) GetIntegrity ¶
func (m FileInfoMap) GetIntegrity() Integrity
GetIntegrity 生成这个FileInfoMap唯一的Integrity
func (FileInfoMap) Reset ¶
func (m FileInfoMap) Reset()
type FileStore ¶
type FileStore struct {
// contains filtered or unexported fields
}
func NewFileStore ¶
func NewFileStore(cfg FileStoreConfig, ignoreFunc ...IgnoreFunc) (*FileStore, error)
NewFileStore 初始化文件存储
func (FileStore) AddDir ¶
func (s FileStore) AddDir(absPath string) (FileInfoMap, error)
AddDir 添加目录到全局文件存储
func (FileStore) BuildDir ¶
func (s FileStore) BuildDir(fim FileInfoMap, pkgDir string) error
BuildDir 通过FileInfoMap构建包目录在工作区构建目录下
func (FileStore) DirIsExist ¶ added in v0.0.4
DirIsExist 检测pkgDir存在
func (FileStore) GetMetadataPath ¶
GetMetadataPath 获取metadata的理论路径
func (FileStore) NewFileInfoMapFromDir ¶
func (s FileStore) NewFileInfoMapFromDir(absPath string) (FileInfoMap, error)
NewFileInfoMapFromDir 仅从文件夹生成FileInfoMap
type FileStoreConfig ¶
type IgnoreFunc ¶
IgnoreFunc 忽略文件的规则 返回真为忽略
type Integrity ¶
type Integrity string
func NewIntegrity ¶
NewIntegrity 新建Integrity实例
func (Integrity) GetRawHashString ¶
GetRawHashString 获取原始hash字符串值 hash to string
func (Integrity) GetRawHashStringAndMod ¶
func (Integrity) GetRawHashStringAndMod256 ¶
func (Integrity) GetRawHashStringAndModFast ¶ added in v0.0.6
GetRawHashStringAndModFast 获取原始hash字符串并且快速取模(i为16的n次方)
func (Integrity) GetRawHashValue ¶
GetRawHashValue 获取原始hash值
type Metadata ¶
type Metadata interface { GetFileInfoMap() FileInfoMap SetFileInfoMap(fim FileInfoMap) Fetch.EasyJsonSerialization }
Click to show internal directories.
Click to hide internal directories.