MCPcopy
hub / github.com/syncthing/syncthing / genFile

Function genFile

internal/db/sqlite/db_test.go:1280–1296  ·  view source on GitHub ↗
(name string, numBlocks int, seq int)

Source from the content-addressed store, hash-verified

1278}
1279
1280func genFile(name string, numBlocks int, seq int) protocol.FileInfo {
1281 ts := timeutil.StrictlyMonotonicNanos()
1282 s := ts / 1e9
1283 ns := int32(ts % 1e9)
1284 return protocol.FileInfo{
1285 Name: name,
1286 Size: int64(numBlocks) * blockSize,
1287 ModifiedS: s,
1288 ModifiedBy: 1,
1289 Version: protocol.Vector{}.Update(1),
1290 Sequence: int64(seq),
1291 Blocks: genBlocks(name, 0, numBlocks),
1292 Permissions: 0o644,
1293 ModifiedNs: ns,
1294 RawBlockSize: blockSize,
1295 }
1296}
1297
1298func genBlocks(name string, seed, count int) []protocol.BlockInfo {
1299 b := make([]protocol.BlockInfo, count)

Callers 15

TestBasicsFunction · 0.85
TestPrefixGlobbingFunction · 0.85
TestPrefixGlobbingStarFunction · 0.85
TestAvailabilityFunction · 0.85
TestDropFilesNamedFunction · 0.85
TestDropFolderFunction · 0.85
TestDropDeviceFunction · 0.85
TestDropAllFilesFunction · 0.85
TestConcurrentUpdateFunction · 0.85
TestAllForBlocksHashFunction · 0.85

Calls 3

StrictlyMonotonicNanosFunction · 0.92
genBlocksFunction · 0.85
UpdateMethod · 0.65

Tested by

no test coverage detected