mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +00:00
- The `internal/uploadstore` package is renamed to `object` indicating
that it is meant to provide a generic object storage wrapper.
- The `search/exhaustive/uploadstore` package is used in very few places
so I've merged into the `internal/search` package similar to
`internal/embeddings`.
There are a few reasons to do the renaming.
1. The word `upload` in a more general context is ambiguous (just in
`internal/`) - in the codeintel context, it means "SCIP index" but it
can also be interpreted generically ("upload of _some_ data").
2. Better readability - `object.Storage` is much shorter than
`uploadstore.Store`. Additionally, we use the term `Store` A LOT
in the codebase, and usually, these refer to wrappers over some
tables in some DB.
Making things worse, some of our code also has:
```
uploadsstore
"github.com/sourcegraph/sourcegraph/internal/codeintel/uploads/internal/store"
```
And code which says `uploadsstore.Store` (notice the extra `s` 😢), which
is actually a wrapper over some key DB tables like `lsif_uploads`.
21 lines
443 B
Go
21 lines
443 B
Go
package object
|
|
|
|
import "io"
|
|
|
|
type closeWrapper struct {
|
|
io.ReadCloser
|
|
close func()
|
|
}
|
|
|
|
func (c *closeWrapper) Close() error {
|
|
c.ReadCloser.Close()
|
|
c.close()
|
|
return nil
|
|
}
|
|
|
|
// newExtraCloser returns wraps a ReadCloser with an extra close function
|
|
// that will be called after the underlying ReadCloser has been closed.
|
|
func newExtraCloser(rc io.ReadCloser, close func()) io.ReadCloser {
|
|
return &closeWrapper{ReadCloser: rc, close: close}
|
|
}
|