{"id":19070713,"url":"https://github.com/powerdns/simpleblob","last_synced_at":"2025-04-28T14:47:36.558Z","repository":{"id":39586154,"uuid":"483963131","full_name":"PowerDNS/simpleblob","owner":"PowerDNS","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-10T18:13:48.000Z","size":151,"stargazers_count":7,"open_issues_count":8,"forks_count":6,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-03-30T10:41:27.640Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/PowerDNS/simpleblob","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PowerDNS.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-04-21T08:11:38.000Z","updated_at":"2025-02-20T15:38:54.000Z","dependencies_parsed_at":"2024-11-09T01:21:08.353Z","dependency_job_id":"8a45c13d-142b-465f-befc-10c5eb31ba4c","html_url":"https://github.com/PowerDNS/simpleblob","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerDNS%2Fsimpleblob","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerDNS%2Fsimpleblob/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerDNS%2Fsimpleblob/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerDNS%2Fsimpleblob/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PowerDNS","download_url":"https://codeload.github.com/PowerDNS/simpleblob/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249436731,"owners_count":21271929,"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":[],"created_at":"2024-11-09T01:20:09.776Z","updated_at":"2025-04-18T05:31:54.309Z","avatar_url":"https://github.com/PowerDNS.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Simpleblob\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/PowerDNS/simpleblob.svg)](https://pkg.go.dev/github.com/PowerDNS/simpleblob)\n[![CI Tests](https://github.com/PowerDNS/simpleblob/actions/workflows/go.yml/badge.svg)](https://github.com/PowerDNS/simpleblob/actions/workflows/go.yml)\n\nSimpleblob is a Go module that simplifies the storage of arbitrary data by key from Go code. It ships with the following backends:\n\n- `s3`: S3 bucket storage\n- `fs`: File storage (one file per blob)\n- `memory`: Memory storage (for tests)\n\n\n## Usage\n\nThe interface implemented by the backends is:\n\n```go\ntype Interface interface {\n\tList(ctx context.Context, prefix string) (BlobList, error)\n\tLoad(ctx context.Context, name string) ([]byte, error)\n\tStore(ctx context.Context, name string, data []byte) error\n\tDelete(ctx context.Context, name string) error\n}\n```\n\nTo instantiate a backend, `_`-import all the backends that you want to register, and call:\n\n```go\nfunc GetBackend(ctx context.Context, typeName string, options map[string]any, params ...Param) (Interface, error)\n```\n\nAn example can be found in `example_test.go`.\n\nEvery backend accepts a `map[string]any` with options and performs its own validation on the options. If you use a YAML, TOML and JSON, you could structure it like this:\n\n```go\ntype Storage struct {\n\tType    string         `yaml:\"type\"`\n\tOptions map[string]any `yaml:\"options\"` // backend specific\n}\n```\n\n\n### `io` interfaces\n\nReading from or writing to a blob directly can be done using the `NewReader` and `NewWriter` functions.\n\n```go\nfunc NewReader(ctx context.Context, storage Interface, blobName string) (io.ReadCloser, error)\nfunc NewWriter(ctx context.Context, storage Interface, blobName string) (io.WriteCloser, error)\n```\n\nThe returned ReadCloser or WriteCloser is an optimized implementation if the backend being used implements the `StreamReader` or `StreamWriter` interfaces.\nIf not, a convenience wrapper for the storage is returned.\n\n| Backend | StreamReader | StreamWriter |\n| --- | --- | --- |\n| S3 | ✔ | ✔ |\n| Filesystem | ✔ | ✔ |\n| Memory | ✖ | ✖ |\n\n\n## API Stability\n\nWe support the last two stable Go versions, currently 1.22 and 1.23.\n\nFrom a API consumer point of view, we do not plan any backward incompatible changes before a v1.0.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowerdns%2Fsimpleblob","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpowerdns%2Fsimpleblob","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowerdns%2Fsimpleblob/lists"}