本文整理匯總了Golang中github.com/Symantec/Dominator/proto/sub.UpdateRequest.DirectoriesToMake方法的典型用法代碼示例。如果您正苦於以下問題:Golang UpdateRequest.DirectoriesToMake方法的具體用法?Golang UpdateRequest.DirectoriesToMake怎麽用?Golang UpdateRequest.DirectoriesToMake使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類github.com/Symantec/Dominator/proto/sub.UpdateRequest
的用法示例。
在下文中一共展示了UpdateRequest.DirectoriesToMake方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: compareDirectories
func compareDirectories(request *subproto.UpdateRequest, state *state,
subDirectory, requiredDirectory *filesystem.Directory,
parentName string, filter *filter.Filter) {
requiredPathName := path.Join(parentName, requiredDirectory.Name)
// First look for entries that should be deleted.
makeSubDirectory := false
if subDirectory == nil {
makeSubDirectory = true
} else {
subPathName := path.Join(parentName, subDirectory.Name)
for name, subEntry := range subDirectory.EntriesByName {
pathname := path.Join(subPathName, entryName(subEntry))
if filter.Match(pathname) {
continue
}
if _, ok := requiredDirectory.EntriesByName[name]; !ok {
request.PathsToDelete = append(request.PathsToDelete, pathname)
fmt.Printf("Delete: %s\n", pathname) // HACK
}
}
if !filesystem.CompareDirectoriesMetadata(subDirectory,
requiredDirectory, os.Stdout) {
fmt.Printf("Different directory: %s...\n", requiredPathName) // HACK
makeSubDirectory = true
// TODO(rgooch): Update metadata.
}
}
if makeSubDirectory {
var newdir subproto.Directory
newdir.Name = requiredPathName
newdir.Mode = requiredDirectory.Mode
newdir.Uid = requiredDirectory.Uid
newdir.Gid = requiredDirectory.Gid
request.DirectoriesToMake = append(request.DirectoriesToMake, newdir)
}
for name, requiredEntry := range requiredDirectory.EntriesByName {
pathname := path.Join(requiredPathName, entryName(requiredEntry))
if filter.Match(pathname) {
continue
}
if subDirectory == nil {
compareEntries(request, state, nil, requiredEntry, requiredPathName,
filter)
} else {
if subEntry, ok := subDirectory.EntriesByName[name]; ok {
compareEntries(request, state, subEntry, requiredEntry,
requiredPathName, filter)
} else {
compareEntries(request, state, nil, requiredEntry,
requiredPathName, filter)
}
}
}
}
示例2: makeDirectory
func makeDirectory(request *subproto.UpdateRequest,
requiredInode *filesystem.DirectoryInode, pathName string, create bool) {
var newInode subproto.Inode
newInode.Name = pathName
var newDirectoryInode filesystem.DirectoryInode
newDirectoryInode.Mode = requiredInode.Mode
newDirectoryInode.Uid = requiredInode.Uid
newDirectoryInode.Gid = requiredInode.Gid
newInode.GenericInode = &newDirectoryInode
if create {
request.DirectoriesToMake = append(request.DirectoriesToMake, newInode)
} else {
request.InodesToChange = append(request.InodesToChange, newInode)
}
}