Ken Dreyer writes: > On Thu, Jan 24, 2013 at 4:14 AM, Marius Mårnes Mathiesen > <marius.mathie...@gmail.com> wrote: >> Another approach could be to use eg. btrfs and set up subvolumes for new >> projects in the repository root, assuming you're running with un-sharded >> paths. Let's say a user creates a project "gitorious" and the first >> repository "mainline": when generating the repository on disk in >> Gitorious we could set up a subvolume for the project, so: >> >> /var/www/gitorious/repositories/gitorious >> >> would become a btrfs subvolume where we could enforce quotas. Achieving >> this would require a hook inside the routine where a repository is >> created in Gitorious, but it would definitely make sense (as long as >> you're ready to trust btrfs with your data). Zfs could be an alternative >> to btrfs, but the license situation is a little problematic here. > > Thank you! I was imagining something vaguely along the same lines. > I'll probably avoid btrfs at this point :) but maybe I can hook up > something with LVM.
Sounds great. I'm really looking forward to using btrfs on gitorious.org, but we'll probably wait a year or so :-) > It looks like I should modify these two functions in app/models/repository.rb? > > def self.create_git_repository(path) > full_path = full_path_from_partial_path(path) > git_backend.create(full_path) > self.create_hooks(full_path) > end > > def self.clone_git_repository(target_path, source_path, options = {}) > full_path = full_path_from_partial_path(target_path) > Grit::Git.with_timeout(nil) do > git_backend.clone(full_path, > full_path_from_partial_path(source_path)) > end > self.create_hooks(full_path) unless options[:skip_hooks] > end > > > What would be the optimal way to modify these in a way that I could > get it accepted upstream? I'm guessing that the > LV-creation-and-mounting code should live in a separate module to > handle all the different commands and the privilege escalation, etc. The GitBackend class would be the best place to place this kind of logic. It is set up with some "hooks" performed after a repository has been created, an approach we should be able to use in a similar fashion *before* creating the repository on disk. What if the GitBackend class had a class method or equivalent for registering hooks from the outside that are performed before a repository is created on disk, which will receive the path to be created: class GitQuotaManager def self.before_create_path(path) # set up LVM etc end end and then in an initializer register this hook: GitBackend.register_before_hook(GitQuotaManager) and extending the GitBackend class like this: def create(repos_path, set_export_ok = true) before_hook.before_create_path(repos_path) # existing logic here end end Would that make sense (thinking out loud here)? Cheers, - Marius -- -- To post to this group, send email to gitorious@googlegroups.com To unsubscribe from this group, send email to gitorious+unsubscr...@googlegroups.com --- You received this message because you are subscribed to the Google Groups "Gitorious" group. To unsubscribe from this group, send email to gitorious+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.