-
-
Notifications
You must be signed in to change notification settings - Fork 481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Push and Pull v2 #89
Push and Pull v2 #89
Conversation
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.
I hate you
rf, err := types.NewRef(cm.commitSt, ddb.db.Format()) | ||
|
||
if err != nil { | ||
return err | ||
} | ||
|
||
return datas.Pull(ctx, srcDB.db, ddb.db, rf, progChan) | ||
if datas.CanUsePuller(srcDB.db) && datas.CanUsePuller(ddb.db) { | ||
puller, err := datas.NewPuller(ctx, tempDir, 256*1024, srcDB.db, ddb.db, rf.TargetHash()) |
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.
const for this magic number?
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.
updated
return err | ||
} | ||
|
||
if puller == nil { |
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 a strange interface. Can't the Pull method respond to a nil pointer and return nil?
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.
updated the interface. Using a new ErrDBUpToDate returned by NewPuller
@@ -150,9 +152,51 @@ func (dcs *DoltChunkStore) Get(ctx context.Context, h hash.Hash) (chunks.Chunk, | |||
} | |||
} | |||
|
|||
func (dcs *DoltChunkStore) GetMany(ctx context.Context, hashes hash.HashSet, foundChunks chan *chunks.Chunk) error { | |||
ae := atomicerr.New() |
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.
Seems like this doesn't really need to be an atomic error, since there is only one writer
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.
the error is modified in a go routine and then checked on the main thread.
ch, err := chable.ToChunk() | ||
|
||
if err != nil { | ||
return map[hash.Hash]int{}, err |
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.
Aren't maps ref types? If so this should be nil, err
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
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
// NewSink still needs to be implemented in order to write to a DoltChunkStore using the TableFileStore interface | ||
func (dcs *DoltChunkStore) NewSink(ctx context.Context, fileId string, numChunks int) (nbs.WriteCloserWithContext, error) { | ||
panic("Not implemented") | ||
// WriteTableFile returns a writer for a new table file. When the writer is closed the table file is persisted |
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.
Comment is not accurate
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
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
go/store/nbs/byte_sink.go
Outdated
return iohelp.WriteAll(wr, sink.buff[:sink.pos]) | ||
} | ||
|
||
// FlushToFile writes all teh data that was written to the file to a file at the provided location. |
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.
teh typo
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
go/store/nbs/byte_sink.go
Outdated
return iohelp.WriteAll(wr, sink.blocks...) | ||
} | ||
|
||
// FlushToFile writes all teh data that was written to the file to a file at the provided location. |
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.
teh typo
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
sink.ae.SetIfError(err) | ||
} | ||
|
||
err = sink.wr.Close() |
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 stomps any previously set 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.
that's fine. It's just updating the ae which won't change if it's already set.
go/store/nbs/byte_sink.go
Outdated
return err | ||
} | ||
|
||
// FlushToFile writes all teh data that was written to the file to a file at the provided location. |
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.
teh
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
repeated ChunkTableInfo chunk_table_info = 3; | ||
} | ||
|
||
message AddTableFilesResponse { |
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.
I think it's more customary to return Empty or throw an exception, rather than make a client check a success flag.
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.
yes. will fix this and commit at a later time.
No description provided.