{"action":"created","issue":{"url":"https://api.github.com/repos/docker/docker/issues/9018","labels_url":"https://api.github.com/repos/docker/docker/issues/9018/labels{/name}","comments_url":"https://api.github.com/repos/docker/docker/issues/9018/comments","events_url":"https://api.github.com/repos/docker/docker/issues/9018/events","html_url":"https://github.com/docker/docker/issues/9018","id":48041938,"number":9018,"title":"tarsum calculation should be resumable","user":{"login":"stevvooe","id":120601,"avatar_url":"https://avatars.githubusercontent.com/u/120601?v=3","gravatar_id":"","url":"https://api.github.com/users/stevvooe","html_url":"https://github.com/stevvooe","followers_url":"https://api.github.com/users/stevvooe/followers","following_url":"https://api.github.com/users/stevvooe/following{/other_user}","gists_url":"https://api.github.com/users/stevvooe/gists{/gist_id}","starred_url":"https://api.github.com/users/stevvooe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevvooe/subscriptions","organizations_url":"https://api.github.com/users/stevvooe/orgs","repos_url":"https://api.github.com/users/stevvooe/repos","events_url":"https://api.github.com/users/stevvooe/events{/privacy}","received_events_url":"https://api.github.com/users/stevvooe/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/docker/docker/labels//dist/registry","name":"/dist/registry","color":"5319e7"},{"url":"https://api.github.com/repos/docker/docker/labels/Distribution","name":"Distribution","color":"e11d21"},{"url":"https://api.github.com/repos/docker/docker/labels/feature","name":"feature","color":"bfd4f2"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2014-11-07T02:46:12Z","updated_at":"2015-02-26T20:27:21Z","closed_at":"2015-02-26T12:22:19Z","body":"To support chunked or streaming tarsum calculations, it would be desirable to be able to save tarsum state mid-computation. This would allow a tarsum calculation to be saved, then resumed later when the rest of the data is available, similar to other kinds of hash calculations.\r\n\r\nThe main application for such a change would be to minimize local file buffering and storage layer round trips in the new version of the registry when accepting layer uploads.\r\n\r\nPossible API additions include the following methods:\r\n\r\n    // State is an opaque representation of a partial tarsum calculation.\r\n    type State <some trivially serializable type, maybe string>\r\n\r\n    // ResumeTarSum continues a tarsum calculation on the provided reader using state. The \r\n    // reader will Seek to the position stored in state and the computation will be resumed.\r\n    ResumeTarSum(rd io.ReadSeeker, state State) (TarSumInterface, error)\r\n\r\nAnd add a state method to `TarSumInterface`:\r\n\r\n    type TarSumInterface interface {\r\n        io.Reader\r\n        GetSums() map[string]string\r\n        Sum([]byte) string\r\n        Version() Version\r\n\r\n        // State returns an opaque state that can be used to resume a partial tarsum calculation. The\r\n        // returned state is valid even if the tarsum calculation reach io.EOF on the underlying reader.\r\n        State() State\r\n    }\r\n\r\n@vbatts @jlhawn "},"comment":{"url":"https://api.github.com/repos/docker/docker/issues/comments/76263158","html_url":"https://github.com/docker/docker/issues/9018#issuecomment-76263158","issue_url":"https://api.github.com/repos/docker/docker/issues/9018","id":76263158,"user":{"login":"jlhawn","id":1441929,"avatar_url":"https://avatars.githubusercontent.com/u/1441929?v=3","gravatar_id":"","url":"https://api.github.com/users/jlhawn","html_url":"https://github.com/jlhawn","followers_url":"https://api.github.com/users/jlhawn/followers","following_url":"https://api.github.com/users/jlhawn/following{/other_user}","gists_url":"https://api.github.com/users/jlhawn/gists{/gist_id}","starred_url":"https://api.github.com/users/jlhawn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jlhawn/subscriptions","organizations_url":"https://api.github.com/users/jlhawn/orgs","repos_url":"https://api.github.com/users/jlhawn/repos","events_url":"https://api.github.com/users/jlhawn/events{/privacy}","received_events_url":"https://api.github.com/users/jlhawn/received_events","type":"User","site_admin":false},"created_at":"2015-02-26T20:27:21Z","updated_at":"2015-02-26T20:27:21Z","body":"Hey! So, just for Funzies: https://github.com/jlhawn/tarsum and http://godoc.org/github.com/jlhawn/tarsum\r\n\r\nI wrote this about 2-3 months ago but never published it. It's an implementation of TarSum (using sha256) which is resumable and matches the `hash.Hash` interface, so you write to it rather than read through it. All the tests pass too! yay!"}}