VictoriaFreSh 2022.2.21 → 2023.5.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5293fd04253e9ab289f8827edf268ea5653d709402de849d5304ea19fc014a10
4
- data.tar.gz: c5aa96e8dd2a479a3d80b411299ae22c8d49f18fa20c3ad051913bbc375ba243
3
+ metadata.gz: 23e525fb7a6fe14cdfec82d42bb2859ec5fc97c5f9b6fb48ca659b30a96a6dc6
4
+ data.tar.gz: 5600d22f51b8f1c24eba9191df29535fdcad54e6ed1648951915864b2ae57b8f
5
5
  SHA512:
6
- metadata.gz: 39014b2e4a571cb0c8da0ddcc7f7d4c0ef4b41a3d61405ed519391d2bc6054d1686e1443be27701e31bd5eb995c99c95e98b465ff6c380b663a34caba6be6d0a
7
- data.tar.gz: 12f6a697b3b4d761cd713e26257e9e4901cd8da3ecbeff5358ae88e1fa0be97ae2f5f451423b9c509859c70c1c5edd78e96ee43dbf9e0bd528a75b931d742be5
6
+ metadata.gz: 67a2a49ab1565bc104b1c36657d595a28d31bdba6e30111b62e8aa6d0d675cb907662ca4391ee36481eb39ca1a922b2b15eb2b2c71868adad65afa1539bc2544
7
+ data.tar.gz: 07051ccdfa64fc0c79a12ba1494ad876d608f8e7ee8c49a98e426471f4f46545dd1e6383930616480e4c3d4d7ff1425adc75f5d14c3e68a966afcdcd6ece4c6c
data/lib/victoriafresh.rb CHANGED
@@ -20,7 +20,7 @@ class VictoriaFresh
20
20
  def initialize
21
21
  @diskFlush=false #要向磁盘写入文件
22
22
  @diskFlushSize=143212 #磁盘分块大小
23
- @diskFileName='victoriafreshdata.v' #磁盘文件名
23
+ @diskFileName='victoriafreshdata' # Disk file name.
24
24
  @ignoreFileName=nil # 忽略文件名列表配置文件名
25
25
  @diskMultiFile=false #磁盘整个文件,不是多个文件
26
26
  @diskWriteFileObject={} #向磁盘写入文件的对象
@@ -202,13 +202,13 @@ class VictoriaFresh
202
202
  end #begin #尝试修改链接本身的权限
203
203
  end #if (permissionNumber.nil?) #不带权限字段
204
204
  end #def makeSymlink(pathPrefix, packagedFile, contentString) #创建符号链接
205
-
205
+
206
206
  def getTimeObject(packagedFile) #构造时间戳对象
207
207
  # seconds=packagedFile.timestamp.seconds #获取秒数
208
- seconds=packagedFile['timestamp']['seconds'] #获取秒数
208
+ seconds=packagedFile['timestamp']['seconds'] # 获取秒数
209
209
 
210
210
  # microSeconds=packagedFile.timestamp.nanos/ 1000.0 #获取毫秒数
211
- microSeconds=packagedFile['timestamp']['nanos'] / 1000.0 #获取毫秒数
211
+ microSeconds=packagedFile['timestamp']['nanos'] / 1000.0 # 获取微秒数
212
212
 
213
213
  timeObject=Time.at(seconds, microSeconds) #构造时间对象
214
214
 
@@ -310,7 +310,7 @@ class VictoriaFresh
310
310
  @contentString=@contentString[@diskFlushSize, @contentString.length-@diskFlushSize] #留下剩余的部分
311
311
 
312
312
  if (@diskMultiFile) #多个磁盘文件
313
- @diskWriteFileObject=File.new(@diskFileName+@currentDiskFlushSuffix.to_s, 'wb') #打开文件
313
+ @diskWriteFileObject=File.new(@diskFileName+@currentDiskFlushSuffix.to_s+'.v', 'wb') #打开文件
314
314
 
315
315
  @currentDiskFlushSuffix=@currentDiskFlushSuffix+1 #增加计数
316
316
 
@@ -340,7 +340,7 @@ class VictoriaFresh
340
340
  @contentString="" #字符串清空
341
341
 
342
342
  if (@diskMultiFile) #多个磁盘文件
343
- @diskWriteFileObject=File.new(@diskFileName+@currentDiskFlushSuffix.to_s, 'wb') #打开文件
343
+ @diskWriteFileObject=File.new(@diskFileName+@currentDiskFlushSuffix.to_s+'.v', 'wb') #打开文件
344
344
 
345
345
  @currentDiskFlushSuffix=@currentDiskFlushSuffix+1 #增加计数
346
346
 
@@ -388,15 +388,19 @@ class VictoriaFresh
388
388
  unless isDirectory # 如果是目录就跳过
389
389
  #记录时间戳:
390
390
  directoryPath=directoryPathName.expand_path # 获取完整路径。
391
- mtimeStamp=File.mtime(directoryPath) #获取时间戳
392
-
393
- fileTimestamp=mtimeStamp.tv_sec # 获取秒数
394
-
395
- #puts "path: #{directoryPath}, time stamp: #{fileTimestamp}, threshold: #{@timestampThreshold}" # debug
396
391
 
397
- if (fileTimestamp< @timestampThreshold) # 文件的时间戳比阈值要小,过早了
398
- result =true # 是过早了
399
- end # if (fileTimestamp< @timestampThreshold) # 文件的时间戳比阈值要小,过早了
392
+ begin #读取时间戳
393
+ mtimeStamp=File.mtime(directoryPath) #获取时间戳
394
+
395
+ fileTimestamp=mtimeStamp.tv_sec # 获取秒数
396
+
397
+ #puts "path: #{directoryPath}, time stamp: #{fileTimestamp}, threshold: #{@timestampThreshold}" # debug
398
+
399
+ if (fileTimestamp< @timestampThreshold) # 文件的时间戳比阈值要小,过早了
400
+ result =true # 是过早了
401
+ end # if (fileTimestamp< @timestampThreshold) # 文件的时间戳比阈值要小,过早了
402
+ rescue Errno::ENOENT
403
+ end #begin #读取时间戳
400
404
  end # unless isDirectory # 如果是目录就跳过
401
405
 
402
406
  result # 返回结果
@@ -407,7 +411,7 @@ class VictoriaFresh
407
411
  if (layer==0) #最外层
408
412
  if (@diskMultiFile) #要写多个文件
409
413
  else #不写多个文件
410
- @diskWriteFileObject=File.new(@diskFileName, 'wb') #打开文件
414
+ @diskWriteFileObject=File.new(@diskFileName+'.v', 'wb') #打开文件
411
415
  end #if (@diskMultiFile) #要写多个文件
412
416
  end #if (layer==0) #最外层
413
417
  end #if (@diskFlush) #要向磁盘写入文件s
@@ -9,7 +9,9 @@ else #指定了命令行参数。
9
9
 
10
10
  $clipDownloader=VictoriaFresh.new #创建下载器。
11
11
 
12
- $clipDownloader.diskFlush=false #不向磁盘写入缓存
12
+ # $clipDownloader.diskFlush=false # Do not write disk cache.
13
+ $clipDownloader.diskFlush=true #write disk cache.
14
+
13
15
  $clipDownloader.diskMultiFile=true #写多个磁盘文件
14
16
  $clipDownloader.diskFileName='victoriafreshdata.v.' #磁盘文件名前缀
15
17
  $clipDownloader.diskFlushSize=32*1024*1024 #磁盘文件大小
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: VictoriaFreSh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2022.2.21
4
+ version: 2023.5.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hxcan Cai
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-20 00:00:00.000000000 Z
11
+ date: 2023-05-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: hx_cbor
@@ -65,7 +65,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
65
65
  - !ruby/object:Gem::Version
66
66
  version: '0'
67
67
  requirements: []
68
- rubygems_version: 3.1.6
68
+ rubygems_version: 3.3.26
69
69
  signing_key:
70
70
  specification_version: 4
71
71
  summary: VictoriaFreSh