checksums.multi: fix $slot help-lint error.
parent
e6c9e76db4
commit
8dece633e6
|
@ -54,7 +54,7 @@ HELP: multi-checksum
|
|||
{ $class-description "This is an instance of the " { $link block-checksum } " mixin. It calculates multiple checksums by sequentially passing the data it receives to all the checksums in its " { $slot "checksums" } " slot. This way, even though the individual checksums are not calculated in parallel, you still can have the performance benefits of only reading a disk file once, or not having to temporarily store the data streamed from a network." } ;
|
||||
|
||||
HELP: multi-state
|
||||
{ $class-description "This class represents the current state of a " { $link multi-checksum } " checksum calculation. It has an array of associated checksum states until it is disposed. You may call " { $link add-checksum-bytes } " multiple times to pipe data to all the checksums in the " { $slot "checksums" } " slot. When finished, call " { $link get-checksum } " to receive the results and release implementation-specific resources, or " { $link dispose } " to release the resources and discard the result. After the first " { $link get-checksum } " call the returned value is stored in the " { $slot "results" } " slot, and subsequent calls return the same value." }
|
||||
{ $class-description "This class represents the current state of a " { $link multi-checksum } " checksum calculation. It has an array of associated checksum states until it is disposed. You may call " { $link add-checksum-bytes } " multiple times to pipe data to all the checksum states in the " { $slot "states" } " slot. When finished, call " { $link get-checksum } " to receive the results and release implementation-specific resources, or " { $link dispose } " to release the resources and discard the result. After the first " { $link get-checksum } " call the returned value is stored in the " { $slot "results" } " slot, and subsequent calls return the same value." }
|
||||
{ $notes "It is not possible to add more data to the checksum after the first " { $link get-checksum } " call."
|
||||
$nl
|
||||
"Most code should use " { $link with-checksum-state } " to make sure the resources are properly disposed of. Higher level words like " { $link checksum-bytes } " and " { $link checksum-stream } " use it to perform the disposal." } ;
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
! Copyright (C) 2018 Alexander Ilin.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors checksums checksums.common destructors fry kernel
|
||||
sequences ;
|
||||
USING: accessors checksums checksums.common destructors fry
|
||||
kernel sequences ;
|
||||
IN: checksums.multi
|
||||
|
||||
TUPLE: multi-checksum checksums ;
|
||||
INSTANCE: multi-checksum block-checksum
|
||||
|
||||
C: <multi-checksum> multi-checksum
|
||||
|
||||
TUPLE: multi-state < disposable states results ;
|
||||
|
||||
M: multi-checksum initialize-checksum-state
|
||||
checksums>> [ initialize-checksum-state ] V{ } map-as
|
||||
checksums>> [ initialize-checksum-state ] map
|
||||
multi-state new-disposable swap >>states ;
|
||||
|
||||
M: multi-state dispose*
|
||||
|
@ -22,5 +22,7 @@ M: multi-state add-checksum-bytes
|
|||
|
||||
M: multi-state get-checksum
|
||||
dup results>> [
|
||||
dup states>> [ get-checksum ] { } map-as [ >>results ] keep
|
||||
dup states>> [ get-checksum ] map [ >>results ] keep
|
||||
] unless* nip ;
|
||||
|
||||
INSTANCE: multi-checksum block-checksum
|
||||
|
|
Loading…
Reference in New Issue