Skip to content

Commit

Permalink
[acmedb] (wip)
Browse files Browse the repository at this point in the history
  • Loading branch information
dopey committed Mar 25, 2021
1 parent 31ad7f2 commit 0368957
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
13 changes: 8 additions & 5 deletions acme/db/nosql/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,8 @@ func (db *DB) GetOrder(id string) (*types.Order, error) {
return o, nil
}

// newOrder returns a new Order type.
func newOrder(db nosql.DB, ops OrderOptions) (*order, error) {
id, err := randID()
func (db *DB) CreateOrder(ctx context.Context, o *types.Order) error {
o.ID, err := randID()
if err != nil {
return nil, err
}
Expand All @@ -112,7 +111,7 @@ func newOrder(db nosql.DB, ops OrderOptions) (*order, error) {
naf = nbf.Add(ops.defaultDuration)
}

o := &order{
dbo := &dbOrder{
ID: id,
AccountID: ops.AccountID,
Created: now,
Expand All @@ -123,7 +122,7 @@ func newOrder(db nosql.DB, ops OrderOptions) (*order, error) {
NotAfter: naf,
Authorizations: authzs,
}
if err := o.save(db, nil); err != nil {
if err := db.saveDBOrder(dbo, nil); err != nil {
return nil, err
}

Expand All @@ -135,6 +134,10 @@ func newOrder(db nosql.DB, ops OrderOptions) (*order, error) {
return o, nil
}

// newOrder returns a new Order type.
func newOrder(db nosql.DB, ops OrderOptions) (*order, error) {
}

type orderIDsByAccount struct{}

// addOrderID adds an order ID to a users index of in progress order IDs.
Expand Down
1 change: 1 addition & 0 deletions acme/types/order.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type Order struct {
Finalize string `json:"finalize"`
Certificate string `json:"certificate,omitempty"`
ID string `json:"-"`
ProvisionerID string `json:"-"`
}

// ToLog enables response logging.
Expand Down

0 comments on commit 0368957

Please sign in to comment.