Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(2024)

Issue 40160043: state: Prepare/UpdateUploadedCharm operations (Closed)

Can't Edit
Can't Publish+Mail
Start Review
Created:
10 years, 4 months ago by dimitern
Modified:
10 years, 4 months ago
Reviewers:
mp+198405, rog
Visibility:
Public.

Description

state: Prepare/UpdateUploadedCharm operations This adds a new field to state.Charm's underlying document: PendingUpload (false by default) and two new state methods: PrepareLocalCharmUpload and UpdateUploadedCharm, which are intended to be called before and after the upcoming charm upload support in the API server. When a charm is uploaded, a unique revision for it must be reserved in state, before the actual upload to provider storage happens. The revision is chosen as max(charmRev, stateRev+1), where charmRev is the revision in charm URL given to PrepareLocalCharmUpload() and stateRev is the highest existing revision of the same charm in state. PendingUpload is false by default and can only be changed by using the Prepare/Update methods. Its inverse value is exposed through IsUploaded() method of state.Charm. PrepareLocalCharmUpload requires a charm URL with a revision and local schema, and returns the charm URL that was added to state. UpdateUploadedCharm takes the same arguments like AddCharm and returns the same as well. It takes care of ensuring the given charm URL refers to a charm in pending state and updates its other info (meta, config, bundle URL and SHA256), reseting the pending flag to false. https://code.launchpad.net/~dimitern/juju-core/219-state-charm-upload/+merge/198405 (do not edit description out of merge proposal)

Patch Set 1 #

Total comments: 22

Patch Set 2 : state: Prepare/UpdateUploadedCharm operations #

Patch Set 3 : state: Prepare/UpdateUploadedCharm operations #

Total comments: 6

Patch Set 4 : state: Prepare/UpdateUploadedCharm operations #

Unified diffs Side-by-side diffs Delta from patch set Stats (+203 lines, -11 lines) Patch
A [revision details] View 1 2 3 1 chunk +2 lines, -0 lines 0 comments Download
M state/charm.go View 2 chunks +12 lines, -5 lines 0 comments Download
M state/charm_test.go View 1 chunk +1 line, -0 lines 0 comments Download
M state/state.go View 1 2 3 3 chunks +107 lines, -6 lines 0 comments Download
M state/state_test.go View 1 2 3 1 chunk +81 lines, -0 lines 0 comments Download

Messages

Total messages: 6
dimitern
Please take a look.
10 years, 4 months ago (2013-12-10 14:26:10 UTC) #1
rog
This looks great. Some comments and suggestions below. https://codereview.appspot.com/40160043/diff/1/state/state.go File state/state.go (right): https://codereview.appspot.com/40160043/diff/1/state/state.go#newcode459 state/state.go:459: // ...
10 years, 4 months ago (2013-12-10 16:32:31 UTC) #2
dimitern
Please take a look. https://codereview.appspot.com/40160043/diff/1/state/state.go File state/state.go (right): https://codereview.appspot.com/40160043/diff/1/state/state.go#newcode459 state/state.go:459: // PrepareCharmUpload must be called ...
10 years, 4 months ago (2013-12-11 09:44:18 UTC) #3
dimitern
Please take a look.
10 years, 4 months ago (2013-12-11 09:53:05 UTC) #4
rog
LGTM, thanks. https://codereview.appspot.com/40160043/diff/1/state/state.go File state/state.go (right): https://codereview.appspot.com/40160043/diff/1/state/state.go#newcode476 state/state.go:476: if curl == nil { On 2013/12/11 ...
10 years, 4 months ago (2013-12-11 10:08:13 UTC) #5
dimitern
10 years, 4 months ago (2013-12-11 12:50:09 UTC) #6
Please take a look.

https://codereview.appspot.com/40160043/diff/40001/state/state.go
File state/state.go (right):

https://codereview.appspot.com/40160043/diff/40001/state/state.go#newcode467
state/state.go:467: if curl == nil {
On 2013/12/11 10:08:13, rog wrote:
> d

Done.

https://codereview.appspot.com/40160043/diff/40001/state/state.go#newcode556
state/state.go:556: // Run the transaction, and retry on abort.
On 2013/12/11 10:08:13, rog wrote:
> d

Done.

https://codereview.appspot.com/40160043/diff/40001/state/state.go#newcode558
state/state.go:558: return nil, err
On 2013/12/11 10:08:13, rog wrote:
> return nil, onAbort(err, fmt.Errorf("charm revision already uploaded"))
> ?

Done.
Sign in to reply to this message.

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b