esthlos-v redux

Posted 2018-08-27

This week, having coerced my Keccak implementation1 to agree with Diana's, I set to the task of integrating Keccak into esthlos-v. In that process, I saw that the original project structure of esthlos-v doesn't clearly convey the logically separable components of a vtron and how they fit together. Hence I'm regrinding esthlos-v into a structure which

  • makes clear what pieces of technology (ideas!) go into a vtron, and
  • enables the user to modify or swap out each dependency as desired, so that, as long as the external interface is adhered to, the vtron as a whole continues to operate correctly.

The new esthlos-v is split splits out five dependencies:

  • a Keccak implementation,
  • a toposort implementation,
  • an interface to GPG,
  • a differ (Hunt-McIlroy), and
  • a patcher.

As a result, we have the following directory structure:


The interfaces to each dependency are fairly obvious2:

keccak: The interface is the procedure

(compute-hash in out)

which reads byte-by-byte from the input stream in and writes the resulting hash, in hexadecimal, to the output stream out. If the calculation and write finish, returns nil, and otherwise returns data indicating error.

toposort: The interface is the procedure

(toposort edges)

where edges is an association list with members of the form (head . tail). The procedure returns a list consisting of the sorted members of the pairs of the association list if the graph determined by the association list is sortable, and returns the symbol cyclic otherwise.

GPG: The interface is the procedure

(check-trust vpatch_file_list seal_dir wot_dir)

takes in a list vpatch_file_list of path designators, and the directories seal_dir and wot_dir. The procedure returns nil if and only if:

  • Each file in wot_dir is a valid public key in GPG format;
  • Each member of vpatch_file_list is a path designator of an existing file;
  • For each member of vpatch_file_list, there is least one corresponding seal seal in seal_dir which passes gpg --verify seal vpatch_file;
  • For each member vpatch_file of vpatch_file_list, every corresponding seal seal in seal_dir passes gpg --verify seal vpatch_file.

If the above conditions are not met, the procedure returns data indicating error.

diff: The interface is the procedure

(diff a b out)

where a and b are pathname designators (possibly pointing to directories), and out is an output stream. The procedure calculates the diff of a to b, and writes this information to out. If the calculation and write complete, the procedure returns nil, and otherwise returns data indicating error.

patch: The interface is the procedure

(patch in d)

where in is an input stream and d is a pathname designator. The procedure reads the entire contents of in, interpreting the contents as a patch, and attempts to apply the patch to the file(s) located at d. If the interpretation and patch succeed, returns nil, and otherwise returns data indicating error.

And that's it for the interfaces. To create the skeleton directory structure, use the genesis vpatch and seal below:

  1. post to follow []
  2. the return data on error is not as straightforward, and I am not specifying it prematurely. []

One Response to “esthlos-v redux”

  1. [...] esthlos Technology Implies Belligerence « esthlos-v redux [...]

Leave a Reply (USE HTML! Space not preserved!)