Add swap/dump/restore API [skip ci]