What is Repo Authoritative!

Its a term associated with Hacklang Processing. It  one of the technique,  Facebook  introduced in hack lang for multiple purposes.
Lets we go through what is Repo Authoritative Technique. before that, unlike interpretation language PHP, HACK can “act asCompilation / Interpretation language. Here, a byte code is generated in HACK, by HHVM (HipHop Virtual machine) known as HHBC(HipHop Byte Code). Repo Authoritative is a technique which determins on which mode HHVM have to activate. when Repo Authoritative is disabled, it act as common Interpretation Language, which generates temporary byte code (hhbc), process it and trash it. Usually this is done at Development Mode. When Repo Authoritative is enabled, they create a permanent HHBC (HH Byte Code) Language File which will be highly optimized, predefned and having much overhead preprocessed. Cool Right? This is used in production mode. FB defines this can even optimize  processing up to  than 20-30%.

If You are Handling a HACK project like FBCTF, if u turned it up in production mode, any change or even if removal of source code cannot touch your application. If you want to have any modification, The file  then disable   “Repo Authoritative”, then re-enable it;

You can do it automatically by-:

sudo hhvm-repo-mode enable /var/www

To disable

sudo hhvm-repo-mode disable

or even mannually-:

If you have PHP files file1.php and file2.php, you can build a bytecode archive named hhvm.hhbc by executing this command:

hhvm --hphp -thhbc -o var/wwww/project/path file1.php file2.php

Now you will have a per-compiled repo file named `some_dir/hhvm.hhbc`. commonly this directory will be `var/cache/hhvm/hhvm.hhbc`

To run the program file1.php, use this command:

hhvm -vRepo.Authoritative=true -vRepo.Central.Path=some_dir/hhvm.hhbc file1.php

Note: If you get the error message Unable to find/load systemlib.php, make sure you are pointing at the hhvm.hhbc file and not the directory.

 

[CREDITS : Git>hhvm>WiKi; hhvm documentation]

 

 

Advertisements