Hacker News new | past | comments | ask | show | jobs | submit login

@plesiv could you please elaborate on how repack/gc is handled with a libgit2 backend? I know that Alibaba has done something similar in the past based on libgit2, but I have yet to see another implementation in the wild like this.

Very cool project. I hope Cloudflare workers can support more protocols like SSH and GRPC. It's one of the reasons why I prefer Fly.io over Cloudflare worker for special servers like this.




Great question! By default, with libgit2 each write to a repo (e.g. push) will create a new pack file. We have written a simple packing algorithm that runs after each write. It works like this:

Choose these values:

* P, pack "Planck" size, e.g. 100kB

* N, branching factor, e.g. 8

After each write:

1. iterate over each pack (pack size is S) and assign each pack a class C which is the smallest integer that satisfies P * N^C > S

2. iterate variable c from 0 to the maximum value of C that you got in step 2

* if there are N packs of class c, repack them into a new pack, new pack is going to be at most of class c+1




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: