33
Reusable Self-Adaptation through Bidirectional Programming Kevin Colson , Robin Dupuis , Lionel Montrieux , Zhenjiang Hu , Sebastian Uchitel ¶§ , Pierre-Yves Schobbens † University of Namur, Belgium National Institute of Informatics, Tokyo, Japan ¶ University of Buenos Aires, Argentina § Imperial College, London, UK

Reusable Self-Adaptation through Bidirectional Programming

Embed Size (px)

Citation preview

Page 1: Reusable Self-Adaptation through Bidirectional Programming

Reusable Self-Adaptation through Bidirectional

ProgrammingKevin Colson†, Robin Dupuis†, Lionel Montrieux◊, Zhenjiang Hu◊,

Sebastian Uchitel¶§, Pierre-Yves Schobbens†

† University of Namur, Belgium ◊ National Institute of Informatics, Tokyo, Japan

¶ University of Buenos Aires, Argentina § Imperial College, London, UK

Page 2: Reusable Self-Adaptation through Bidirectional Programming

User www-data Group www-data ServerRoot "/etc/apache2" PidFile /var/run/apache2/apache2.pid ErrorLog /var/log/apache2/error.log

Page 3: Reusable Self-Adaptation through Bidirectional Programming

User www-data Group www-data ServerRoot "/etc/apache2" PidFile /var/run/apache2/apache2.pid Timeout 300 ErrorLog /var/log/apache2/error.log LogLevel warn

Page 4: Reusable Self-Adaptation through Bidirectional Programming

User www-data Group www-data ServerRoot "/etc/apache2" PidFile /var/run/apache2/apache2.pid Timeout 300 ErrorLog /var/log/apache2/error.log LogLevel warn

<VirtualHost *:80> ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html

</VirtualHost>

Page 5: Reusable Self-Adaptation through Bidirectional Programming

User www-data Group www-data ServerRoot "/etc/apache2" PidFile /var/run/apache2/apache2.pid Timeout 300 ErrorLog /var/log/apache2/error.log LogLevel warn

<VirtualHost *:80> ServerName www.nii.ac.jp ServerAdmin [email protected] DocumentRoot /var/www/html ErrorLog /var/log/apache2/nii_error.log

</VirtualHost>

Page 6: Reusable Self-Adaptation through Bidirectional Programming

M A P E

K

Target System

Environment

Page 7: Reusable Self-Adaptation through Bidirectional Programming

File’FileReloadService

(E)Changes

(A,P)

Page 8: Reusable Self-Adaptation through Bidirectional Programming

gzip on; index index.html index.htm; keepalive_timeout 65; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log;

Page 9: Reusable Self-Adaptation through Bidirectional Programming

gzip off; index index.html index.htm; keepalive_timeout 65; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log;

Page 10: Reusable Self-Adaptation through Bidirectional Programming

$ service nginx reload

Page 11: Reusable Self-Adaptation through Bidirectional Programming

ErrorLog /var/log/apache2/error.log <ifModule mod_gzip.c> mod_gzip_on Yes </ifModule> Listen 80 Listen 443

<VirtualHost *:80> ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html

Page 12: Reusable Self-Adaptation through Bidirectional Programming

ErrorLog /var/log/apache2/error.log <ifModule mod_gzip.c> mod_gzip_on No </ifModule> Listen 80 Listen 443

<VirtualHost *:80> ServerName www.example.com ServerAdmin webmaster@localhost DocumentRoot /var/www/html

Page 13: Reusable Self-Adaptation through Bidirectional Programming

$ service httpd restart

Page 14: Reusable Self-Adaptation through Bidirectional Programming

ApacheReloadService

(E)

Changes Apache Apache’

NginxReloadService

(E)Changes

Nginx Nginx’

WebSrvChanges WebSrv WebSrv’

Page 15: Reusable Self-Adaptation through Bidirectional Programming

WebSrv

Apache …Nginx

Synchronisation

Page 16: Reusable Self-Adaptation through Bidirectional Programming

Bidirectional Transformations

Page 17: Reusable Self-Adaptation through Bidirectional Programming

get :: Source -> View put :: Source -> View -> Source

get (x:xs) = x put (x:xs) y = y:xs

get [1,2,3] = 1 put [1,2,3] 99 = [99,2,3]

[Foster09]

Page 18: Reusable Self-Adaptation through Bidirectional Programming

GetPutput s (get s) = s

put [1,2,3] (get [1,2,3]) = [1,2,3]

put [1,2,3] 1 = [1,2,3]

[Foster10]

Page 19: Reusable Self-Adaptation through Bidirectional Programming

PutGetget (put s v) = v

get (put [1,2,3] 99) = 99

get [99,2,3] = 99

[Foster10]

Page 20: Reusable Self-Adaptation through Bidirectional Programming

Bidirectional Programming

Page 21: Reusable Self-Adaptation through Bidirectional Programming

Putback-based (BiGUL)

updNginx :: BiGUL Nginx Common

get :: BiGUL s v -> s -> GetResult s v

put :: BiGUL s v -> s -> v -> PutResult s v

[Fischer15, Ko16]

Page 22: Reusable Self-Adaptation through Bidirectional Programming

Default Values?

Page 23: Reusable Self-Adaptation through Bidirectional Programming

defaults :: DefaultValues defaults = DefaultValues { d_accept_mutex = "on", d_accept_mutex_delay = "500ms", d_access_log = "logs/access.log combined” }

Page 24: Reusable Self-Adaptation through Bidirectional Programming

updNginx :: BiGUL Nginx Common

Page 25: Reusable Self-Adaptation through Bidirectional Programming

updNginx :: DefaultValues -> BiGUL Nginx Common

Page 26: Reusable Self-Adaptation through Bidirectional Programming

Context Overriding?

Page 27: Reusable Self-Adaptation through Bidirectional Programming

Putting it all together

Page 28: Reusable Self-Adaptation through Bidirectional Programming

conf.file parser source get

view

def. vals.

APview’put

source’ prettyprinter

conf. file’

servicereload X

Page 29: Reusable Self-Adaptation through Bidirectional Programming

One more thing…

Page 30: Reusable Self-Adaptation through Bidirectional Programming

WebSrv

Apache Nginx

Nginx (empty)

putnginxgetapache

Page 31: Reusable Self-Adaptation through Bidirectional Programming

Case Study

Page 32: Reusable Self-Adaptation through Bidirectional Programming

Conclusion

Page 33: Reusable Self-Adaptation through Bidirectional Programming

https://github.com/prl-tokyo/bigul-configuration-adaptation

Check it out

Try BiGUL

$ cabal install bigul

Get in [email protected]