当前位置: 首页>>代码示例>>Golang>>正文


Golang FileInfoTruncated.IsDeleted方法代码示例

本文整理汇总了Golang中github.com/syncthing/syncthing/protocol.FileInfoTruncated.IsDeleted方法的典型用法代码示例。如果您正苦于以下问题:Golang FileInfoTruncated.IsDeleted方法的具体用法?Golang FileInfoTruncated.IsDeleted怎么用?Golang FileInfoTruncated.IsDeleted使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/syncthing/syncthing/protocol.FileInfoTruncated的用法示例。


在下文中一共展示了FileInfoTruncated.IsDeleted方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: ldbReplaceWithDelete

func ldbReplaceWithDelete(db *leveldb.DB, repo, node []byte, fs []protocol.FileInfo) uint64 {
	return ldbGenericReplace(db, repo, node, fs, func(db dbReader, batch dbWriter, repo, node, name []byte, dbi iterator.Iterator) uint64 {
		var tf protocol.FileInfoTruncated
		err := tf.UnmarshalXDR(dbi.Value())
		if err != nil {
			panic(err)
		}
		if !tf.IsDeleted() {
			if debug {
				l.Debugf("mark deleted; repo=%q node=%v name=%q", repo, protocol.NodeIDFromBytes(node), name)
			}
			ts := clock(tf.LocalVersion)
			f := protocol.FileInfo{
				Name:         tf.Name,
				Version:      lamport.Default.Tick(tf.Version),
				LocalVersion: ts,
				Flags:        tf.Flags | protocol.FlagDeleted,
				Modified:     tf.Modified,
			}
			batch.Put(dbi.Key(), f.MarshalXDR())
			ldbUpdateGlobal(db, batch, repo, node, nodeKeyName(dbi.Key()), f.Version)
			return ts
		}
		return 0
	})
}
开发者ID:neuroradiology,项目名称:syncthing,代码行数:26,代码来源:leveldb.go


注:本文中的github.com/syncthing/syncthing/protocol.FileInfoTruncated.IsDeleted方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。