-
Notifications
You must be signed in to change notification settings - Fork 534
Conversation
} | ||
|
||
func (d *Decoder) readObjects(count uint32) error { | ||
for i := 0; i < int(count); i++ { | ||
func (d *Decoder) readObjectsWithObjectStorer(count int) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like the name should be readObjectsToObjectStorer, To instead of With.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's because you have another readObjects
without a s.o
set (the core.ObjectStorer
), I think is clear enough being in the context (is a deep one)
@@ -11,41 +11,46 @@ var ( | |||
ErrNotImplemented = errors.New("method not-implemented") | |||
) | |||
|
|||
// ObjectStorage generic storage of objects | |||
type ObjectStorage interface { | |||
// ObjectStorer generic storage of objects |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change the comment to include the word persist, as the other storers.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as we agreed, persistent is not a property intrinsic to a ObjectStorer
// Iter returns a custom ObjectIter over all the object on the storage. | ||
// TreeObject and AnyObject. If AnyObject is given, the object must be | ||
// looked up regardless of its type. | ||
GetObject(ObjectType, Hash) (Object, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be called Object instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
|
||
// ObjectStorerTx is a optional method for ObjectStorer, it enable transaction | ||
// base write and read operations in the storage | ||
type ObjectStorerTx interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are going too far with the naming of this types, I suggest naming this Tx and move it to an store/object package.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
having another package for a interface maybe is too much. Maybe just call the interface Transactional
?
// ErrNotImplemented error. | ||
// PackfileWriter is a optional method for ObjectStorer, it enable direct write | ||
// of packfile to the storage | ||
type PackfileWriter interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interface and method with the same name: we need to rethink how to organize or code.
Get(ObjectType, Hash) (Object, error) | ||
// TxObjectStorer is an in-progress storage transaction. A transaction must end | ||
// with a call to Commit or Rollback. | ||
type TxObjectStorer interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have an ObjectStorerTx interface and a TxObjectStorer interface.
We must step back, think and organize the code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also we must split all this concepts in their own files.
@@ -2,19 +2,14 @@ | |||
package filesystem | |||
|
|||
import ( | |||
"gopkg.in/src-d/go-git.v4/config" | |||
"gopkg.in/src-d/go-git.v4/core" | |||
"gopkg.in/src-d/go-git.v4/storage/filesystem/internal/dotgit" | |||
"gopkg.in/src-d/go-git.v4/utils/fs" | |||
) | |||
|
|||
type Storage struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs comments, is this an implementation of Storer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, done
@@ -12,94 +12,46 @@ var ErrUnsupportedObjectType = fmt.Errorf("unsupported object type") | |||
|
|||
// Storage in memory storage system |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence doesn't have any verb.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
|
||
"gopkg.in/src-d/go-git.v4/config" | ||
"gopkg.in/src-d/go-git.v4/core" | ||
|
||
. "gopkg.in/check.v1" | ||
) | ||
|
||
type storer interface { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a comment. Why is this type needed, how it is different than Storer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is part of the public suite test. If we make reference here to Storer at the main package we will get a cyclic dependency
ConfigStorage() config.ConfigStorage | ||
ObjectStorage() core.ObjectStorage | ||
ReferenceStorage() core.ReferenceStorage | ||
// Storer storage of objects, references and all the information that require |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This sentence makes no sense, it has no verb.
Also, is this comment accurate?, does the memory implementation persist data?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
Renames:
core.ObjectStorage
=>core.ObjectStorer
core.ReferenceStorage
=>core.ReferenceStorer
config.ConfigStorage
=>core.ConfigStorer
config.Storage
=>core.Storer
core.ObjectStorageWriter
=>core.PackfileWriter
All the inner methods now are compatible between all the
*Storer
interfaces. The maingit.Storage
now is just a group of all the others*Storer
interfaces.A new
core.ObjectStorerTx
was create with the goal of having optional transactions in the storersThe
config.Storer
was simplified to only two methodsSetConfig
andConfig