{"id":27881848,"url":"https://github.com/src-d/go-borges","last_synced_at":"2025-10-07T02:10:35.478Z","repository":{"id":57487138,"uuid":"149303526","full_name":"src-d/go-borges","owner":"src-d","description":null,"archived":false,"fork":false,"pushed_at":"2019-10-17T13:37:02.000Z","size":9855,"stargazers_count":7,"open_issues_count":3,"forks_count":7,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-05-05T05:05:38.115Z","etag":null,"topics":["git"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/src-d.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-09-18T14:38:13.000Z","updated_at":"2025-03-31T00:03:31.000Z","dependencies_parsed_at":"2022-09-01T23:01:43.859Z","dependency_job_id":null,"html_url":"https://github.com/src-d/go-borges","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-borges","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-borges/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-borges/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/src-d%2Fgo-borges/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/src-d","download_url":"https://codeload.github.com/src-d/go-borges/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252442486,"owners_count":21748451,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git"],"created_at":"2025-05-05T05:05:44.195Z","updated_at":"2025-10-07T02:10:30.459Z","avatar_url":"https://github.com/src-d.png","language":"Go","readme":"[![GoDoc](https://godoc.org/github.com/src-d/go-borges?status.svg)](https://godoc.org/github.com/src-d/go-borges)\n[![Build Status](https://travis-ci.com/src-d/go-borges.svg)](https://travis-ci.com/src-d/go-borges)\n[![codecov.io](https://codecov.io/github/src-d/go-borges/coverage.svg)](https://codecov.io/github/src-d/go-borges)\n[![Go Report Card](https://goreportcard.com/badge/github.com/src-d/go-borges)](https://goreportcard.com/report/github.com/src-d/go-borges)\n\n# go-borges\n\nThis library abstracts read and write access to a set of [go-git](https://github.com/src-d/go-git) repositories. It comes with several implementations to support different storage methods:\n\n* `plain`: stored in the filesystem, supports transactions.\n* `siva`: [rooted repositories](https://github.com/src-d/gitcollector#storing-repositories-using-rooted-repositories) in [siva files](https://github.com/src-d/go-siva), supports transactions. These files can be generated with [gitcollector](https://github.com/src-d/gitcollector).\n* `legacysiva`: siva file generated by [borges](https://github.com/src-d/borges). This implementation only supports reading and does not support transactions.\n\nWhen transactions are supported the writes to the repositories will be atomic and could only be seen by new readers when `Commit` function is called. That is, after opening a repository in read only mode any writes to it by another thread or process won't modify its contents. This is useful when the storage that is being used for reading repositories is being updated at the same time. More information and example in `siva` package documentation.\n\n# Installation\n\n`go-borges` supports go modules and can be added to your project with:\n\n```\n$ go get github.com/src-d/go-borges\n```\n\n# Example of utilization\n\nThis example lists the repositories downloaded by gitcollector.\n\n```\npackage main\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/src-d/go-borges\"\n\t\"github.com/src-d/go-borges/siva\"\n\t\"gopkg.in/src-d/go-billy.v4/osfs\"\n)\n\nfunc main() {\n\tif len(os.Args) != 2 {\n\t\tfmt.Println(\"you need to provide the path of your siva files\")\n\t\tos.Exit(1)\n\t}\n\tfs := osfs.New(os.Args[1])\n\n\tlib, err := siva.NewLibrary(\"library\", fs, \u0026siva.LibraryOptions{\n\t\tBucket:        2,\n\t\tRootedRepo:    true,\n\t\tTransactional: true,\n\t})\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\trepos, err := lib.Repositories(borges.ReadOnlyMode)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\terr = repos.ForEach(func(r borges.Repository) error {\n\t\tid := r.ID().String()\n\t\thead, err := r.R().Head()\n\t\tif err != nil {\n\t\t\treturn err\n\t\t}\n\n\t\tfmt.Printf(\"repository: %v, HEAD: %v\\n\", id, head.Hash().String())\n\t\treturn nil\n\t})\n}\n```\n\n# Contribute\n\n[Contributions](https://github.com/src-d/{project}/issues) are more than welcome, if you are interested please take a look to\nour [Contributing Guidelines](CONTRIBUTING.md).\n\n# Code of Conduct\n\nAll activities under source{d} projects are governed by the [source{d} code of conduct](.github/CODE_OF_CONDUCT.md).\n\n# License\n\nApache License Version 2.0, see [LICENSE](LICENSE).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrc-d%2Fgo-borges","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrc-d%2Fgo-borges","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrc-d%2Fgo-borges/lists"}