engine: resources: Add new gzip resource
This may have lots of uses, particularly for bootstrapping and handoff if we want to compress payloads. It is also a good model resource for how to implement such a resource to avoid re-computing the result on every CheckApply call. Of course if the computation is cheaper than the hashing of the data this isn't the optimal approach.
This commit is contained in:
17
examples/lang/gzip.mcl
Normal file
17
examples/lang/gzip.mcl
Normal file
@@ -0,0 +1,17 @@
|
||||
# gzip a file!
|
||||
file "/tmp/input" {
|
||||
state => "exists",
|
||||
content => "hello world from purpleidea!\n",
|
||||
}
|
||||
|
||||
gzip "/tmp/input.gz" {
|
||||
input => "/tmp/input",
|
||||
level => $const.res.gzip.level.no_compression,
|
||||
|
||||
Depend => File["/tmp/input"], # TODO: add autoedges
|
||||
}
|
||||
|
||||
gzip "/tmp/data.gz" {
|
||||
content => "hello world from purpleidea!\n",
|
||||
level => $const.res.gzip.level.best_compression,
|
||||
}
|
||||
Reference in New Issue
Block a user