gitfs
TRANSCRIPT
gitfs@vtemian
gitfs - Pytim #7
$whoami
gitfs - Pytim #7
gitfs - Pytim #7
the problem
CHAOS!
gitfs - Pytim #7
gitfs - Pytim #7
gitfs - Pytim #7
introducing gitfs
gitfs - Pytim #7
gitfswhat is it?
gitfs - Pytim #7
demo
gitfs - Pytim #7
easy!as 1,2,3
gitfs - Pytim #7
gitfs - Pytim #7
open-source
gitfs - Pytim #7
how was it made?
gitfs - Pytim #7
research
gitfs - Pytim #7
for git
gitfs - Pytim #7
git=pygit2
gitfs - Pytim #7
from pygit2 import clone_repository, Keypair
gitfs - Pytim #7
from pygit2 import clone_repository, Keypair
credentials = Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "")
gitfs - Pytim #7
from pygit2 import clone_repository, Keypair
credentials = Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "")
repository = clone_repository("[email protected]:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials)
gitfs - Pytim #7
from pygit2 import clone_repository, Keypair
credentials = Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "")
repository = clone_repository("[email protected]:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials)
remote = [remote for remote in repo.remotes if remote.name == "origin"] remote[0].credentials = credentials
gitfs - Pytim #7
from pygit2 import clone_repository, Keypair
credentials = Keypair("git", "/home/wok/.ssh/ unsafe_key.pub","/home/wok/.ssh/unsafe_key", "")
repository = clone_repository("[email protected]:vtemian/gitfs-demo","/home/wok/gitfs-demo", credentials=credentials)
remote = [remote for remote in repo.remotes if remote.name == "origin"] remote[0].credentials = credentials remote[0].push("refs/heads/master")
gitfs - Pytim #7
for the file system
gitfs - Pytim #7
file system=fusepy
gitfs - Pytim #7
class Memory(Operations):
gitfs - Pytim #7
class Memory(Operations): def open(self, path, flags): self.fd += 1 return self.fd
gitfs - Pytim #7
class Memory(Operations): def open(self, path, flags): self.fd += 1 return self.fd
def read(self, path, size, offset, fh): return self.data[path][offset:offset + size]
gitfs - Pytim #7
class Memory(Operations): def open(self, path, flags): self.fd += 1 return self.fd
def read(self, path, size, offset, fh): return self.data[path][offset:offset + size]
def rename(self, old, new): self.files[new] = self.files.pop(old)
gitfs - Pytim #7
class Memory(Operations): def open(self, path, flags): self.fd += 1 return self.fd
def read(self, path, size, offset, fh): return self.data[path][offset:offset + size]
def rename(self, old, new): self.files[new] = self.files.pop(old)
def rmdir(self, path): self.files.pop(path) self.files['/']['st_nlink'] -= 1
gitfs - Pytim #7
class Memory(Operations): def open(self, path, flags): self.fd += 1 return self.fd
def read(self, path, size, offset, fh): return self.data[path][offset:offset + size]
def rename(self, old, new): self.files[new] = self.files.pop(old)
def rmdir(self, path): self.files.pop(path) self.files['/']['st_nlink'] -= 1
def write(self, path, data, offset, fh): self.data[path] = self.data[path][:offset] +data self.files[path]['st_size'] = len(self.data[path]) return len(data)
gitfs - Pytim #7
first iteration
gitfs - Pytim #7
very dirty
def rename(self, old, new): if "history" in old or new: # raise EROFS elif old == "/" or new == "/": # raise EROFS else: # do the actual rename
gitfs - Pytim #7
second iteration
gitfs - Pytim #7
read()
Router
CurrentView HistoryView CommitView IndexView
gitfs - Pytim #7
read('/history/2014-10-18/14-01-04-fg34asc4/Readme.md')
CommitView
gitfs - Pytim #7
upstream synchronization
gitfs - Pytim #7
solve conflicts
gitfs - Pytim #7
solve conflicts
1 2 3
7 8
4 5 6
remote
local
gitfs - Pytim #7
solve conflicts1 2 3 4 5 6
merging_remote
1 2 3 7 8merging_local
gitfs - Pytim #7
1 2 3 4 5 7'6 8'local
solve conflicts
gitfs - Pytim #7
third iteration
gitfs - Pytim #7
cache
gitfs - Pytim #7
upstream synchronization
gitfs - Pytim #7
Fuse threads
gitfs - Pytim #7
commits
Fuse threads
gitfs - Pytim #7
Commit queue
commits
Fuse threads
gitfs - Pytim #7
Sync workerCommit queue
commits
Fuse threads
gitfs - Pytim #7
want to syncdon't open for write
Commit queueSync worker
commits
Fuse threads
gitfs - Pytim #7
commit
want to syncdon't open for write
Commit queueSync worker
commits
Fuse threads
gitfs - Pytim #7
commit
sync done
want to syncdon't open for write
Commit queue Fetch workerSync worker
fetch
fetch
fetch
commits
Fuse threads
gitfs - Pytim #7
pytest
gitfs - Pytim #7
$ sudo add-apt-repository ppa:presslabs/gitfs $ sudo apt-get update $ sudo apt-get install gitfs
gitfs - Pytim #7
commits forks
stars releases
868 27
606 11
gitfs - Pytim #7
github.com/PressLabs/gitfs
gitfs - Pytim #7
Q/A?
gitfs - Pytim #7
thank you
gitfs - Pytim #7