diff --git a/_integration/cmp/deployment.go b/_integration/cmp/deployment.go index 0c55fbba69..a1c12122c1 100644 --- a/_integration/cmp/deployment.go +++ b/_integration/cmp/deployment.go @@ -49,7 +49,7 @@ func deployQueryState(daddr vars.Ref, state types.Deployment_DeploymentState) ge func orderQuery(daddr vars.Ref) gestalt.Component { parse := js.Do( - js.Str(daddr.Var(), "items", "[0]", "deployment"), + js.Str(daddr.Var(), "items", "[0]", "id", "deployment"), ) return akash("order-query", "query", "order"). @@ -59,7 +59,7 @@ func orderQuery(daddr vars.Ref) gestalt.Component { func leaseQuery(daddr vars.Ref) gestalt.Component { parse := js.Do( - js.Str(daddr.Var(), "items", "[0]", "deployment"), + js.Str(daddr.Var(), "items", "[0]", "id", "deployment"), ) return akash("lease-query", "query", "lease"). diff --git a/app/deployment/app.go b/app/deployment/app.go index e4d1fbea0a..b952a01d13 100644 --- a/app/deployment/app.go +++ b/app/deployment/app.go @@ -7,9 +7,9 @@ import ( "github.com/gogo/protobuf/proto" apptypes "github.com/ovrclk/akash/app/types" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/types" - "github.com/ovrclk/akash/types/base" "github.com/ovrclk/akash/types/code" tmtypes "github.com/tendermint/abci/types" "github.com/tendermint/tmlibs/log" @@ -39,10 +39,11 @@ func (a *app) Query(req tmtypes.RequestQuery) tmtypes.ResponseQuery { } } - // todo: need abtraction for multiple query types per app + // TODO: Partial Key Parsing + if strings.HasPrefix(req.GetPath(), state.DeploymentGroupPath) { id := strings.TrimPrefix(req.Path, state.DeploymentGroupPath) - key, err := base.DecodeString(id) + key, err := keys.ParseGroupPath(id) if err != nil { return tmtypes.ResponseQuery{ Code: code.ERROR, @@ -52,9 +53,12 @@ func (a *app) Query(req tmtypes.RequestQuery) tmtypes.ResponseQuery { return a.doDeploymentGroupQuery(key) } - // todo: abstractiion: all queries should have this id := strings.TrimPrefix(req.Path, state.DeploymentPath) - key, err := base.DecodeString(id) + if len(id) == 0 { + return a.doRangeQuery() + } + + key, err := keys.ParseDeploymentPath(id) if err != nil { return tmtypes.ResponseQuery{ Code: code.ERROR, @@ -62,10 +66,6 @@ func (a *app) Query(req tmtypes.RequestQuery) tmtypes.ResponseQuery { } } - // id is empty string, get full range - if len(id) == 0 { - return a.doRangeQuery(key) - } return a.doQuery(key) } @@ -105,9 +105,9 @@ func (a *app) DeliverTx(ctx apptypes.Context, tx interface{}) tmtypes.ResponseDe } } -func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { +func (a *app) doQuery(key keys.Deployment) tmtypes.ResponseQuery { - dep, err := a.State().Deployment().Get(key) + dep, err := a.State().Deployment().Get(key.ID()) if err != nil { return tmtypes.ResponseQuery{ @@ -119,7 +119,7 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { if dep == nil { return tmtypes.ResponseQuery{ Code: code.NOT_FOUND, - Log: fmt.Sprintf("deployment %x not found", key), + Log: fmt.Sprintf("deployment %v not found", key.Path()), } } @@ -137,7 +137,7 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { } } -func (a *app) doRangeQuery(key base.Bytes) tmtypes.ResponseQuery { +func (a *app) doRangeQuery() tmtypes.ResponseQuery { deps, err := a.State().Deployment().GetMaxRange() if err != nil { return tmtypes.ResponseQuery{ @@ -160,9 +160,9 @@ func (a *app) doRangeQuery(key base.Bytes) tmtypes.ResponseQuery { } } -func (a *app) doDeploymentGroupQuery(key base.Bytes) tmtypes.ResponseQuery { +func (a *app) doDeploymentGroupQuery(key keys.DeploymentGroup) tmtypes.ResponseQuery { - dep, err := a.State().DeploymentGroup().GetByKey(key) + dep, err := a.State().DeploymentGroup().Get(key.ID()) if err != nil { return tmtypes.ResponseQuery{ @@ -174,7 +174,7 @@ func (a *app) doDeploymentGroupQuery(key base.Bytes) tmtypes.ResponseQuery { if dep == nil { return tmtypes.ResponseQuery{ Code: code.NOT_FOUND, - Log: fmt.Sprintf("deployment group %x not found", key), + Log: fmt.Sprintf("deployment group %v not found", key.Path()), } } @@ -296,8 +296,10 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateDeployme for _, group := range groups { g := &types.DeploymentGroup{ - Deployment: deployment.Address, - Seq: seq.Advance(), + DeploymentGroupID: types.DeploymentGroupID{ + Deployment: deployment.Address, + Seq: seq.Advance(), + }, State: types.DeploymentGroup_OPEN, Requirements: group.Requirements, Resources: group.Resources, diff --git a/app/deployment/app_test.go b/app/deployment/app_test.go index bc0b1e5583..758de08208 100644 --- a/app/deployment/app_test.go +++ b/app/deployment/app_test.go @@ -10,6 +10,7 @@ import ( "github.com/ovrclk/akash/app/order" "github.com/ovrclk/akash/app/provider" apptypes "github.com/ovrclk/akash/app/types" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/query" pstate "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/testutil" @@ -62,7 +63,7 @@ func TestCreateTx(t *testing.T) { } { - path := query.DeploymentGroupPath(depl.Address, groupseq) + path := query.DeploymentGroupPath(groups.Items[0].DeploymentGroupID) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) @@ -81,24 +82,31 @@ func TestCreateTx(t *testing.T) { require.True(t, resp.IsOK()) } + badgroup := types.DeploymentGroupID{ + Deployment: depl.Address, + Seq: 2, + } + + goodgroup := groups.GetItems()[0].DeploymentGroupID + { - path := fmt.Sprintf("%v%x", + path := fmt.Sprintf("%v%v", pstate.DeploymentPath, - pstate.DeploymentGroupID(depl.Address, 1)) + keys.DeploymentGroupID(badgroup).Path()) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.NotEmpty(t, resp.Log) require.False(t, resp.IsOK()) } { - path := query.DeploymentGroupPath(depl.Address, 1) + path := query.DeploymentGroupPath(goodgroup) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) } { - path := query.DeploymentGroupPath(depl.Address, 0) + path := query.DeploymentGroupPath(badgroup) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.NotEmpty(t, resp.Log) require.False(t, resp.IsOK()) @@ -129,20 +137,21 @@ func TestTx_BadTxType(t *testing.T) { } func TestCloseTx_1(t *testing.T) { - const gseq = 1 state := testutil.NewState(t, nil) app, err := deployment.NewApp(state, testutil.Logger()) require.NoError(t, err) account, key := testutil.CreateAccount(t, state) nonce := uint64(1) - depl, _ := testutil.CreateDeployment(t, app, account, key, nonce) + depl, groups := testutil.CreateDeployment(t, app, account, key, nonce) + + group := groups.Items[0] check := func( dstate types.Deployment_DeploymentState, gstate types.DeploymentGroup_DeploymentGroupState) { assertDeploymentState(t, app, depl.Address, dstate) - assertDeploymentGroupState(t, app, depl.Address, gseq, gstate) + assertDeploymentGroupState(t, app, group.DeploymentGroupID, gstate) } check(types.Deployment_ACTIVE, types.DeploymentGroup_OPEN) @@ -155,7 +164,6 @@ func TestCloseTx_1(t *testing.T) { func TestCloseTx_2(t *testing.T) { const ( - gseq = 1 oseq = 3 ) @@ -165,20 +173,21 @@ func TestCloseTx_2(t *testing.T) { account, key := testutil.CreateAccount(t, state) nonce := uint64(1) - depl, _ := testutil.CreateDeployment(t, app, account, key, nonce) + depl, groups := testutil.CreateDeployment(t, app, account, key, nonce) + group := groups.Items[0] oapp, err := order.NewApp(state, testutil.Logger()) require.NoError(t, err) - testutil.CreateOrder(t, oapp, account, key, depl.Address, gseq, oseq) + order := testutil.CreateOrder(t, oapp, account, key, depl.Address, group.Seq, oseq) check := func( dstate types.Deployment_DeploymentState, gstate types.DeploymentGroup_DeploymentGroupState, ostate types.Order_OrderState) { assertDeploymentState(t, app, depl.Address, dstate) - assertDeploymentGroupState(t, app, depl.Address, gseq, gstate) - assertOrderState(t, oapp, depl.Address, gseq, oseq, ostate) + assertDeploymentGroupState(t, app, order.GroupID(), gstate) + assertOrderState(t, oapp, order.OrderID, ostate) } check(types.Deployment_ACTIVE, types.DeploymentGroup_OPEN, types.Order_OPEN) @@ -191,7 +200,6 @@ func TestCloseTx_2(t *testing.T) { func TestCloseTx_3(t *testing.T) { const ( - gseq = 1 oseq = 3 price = 0 ) @@ -201,17 +209,18 @@ func TestCloseTx_3(t *testing.T) { require.NoError(t, err) account, key := testutil.CreateAccount(t, state) nonce := uint64(1) - depl, _ := testutil.CreateDeployment(t, app, account, key, nonce) + depl, groups := testutil.CreateDeployment(t, app, account, key, nonce) + group := groups.Items[0] orderapp, err := order.NewApp(state, testutil.Logger()) require.NoError(t, err) - testutil.CreateOrder(t, orderapp, account, key, depl.Address, gseq, oseq) + order := testutil.CreateOrder(t, orderapp, account, key, depl.Address, group.Seq, oseq) providerapp, err := provider.NewApp(state, testutil.Logger()) prov := testutil.CreateProvider(t, providerapp, account, key, nonce) fulfillmentapp, err := fulfillment.NewApp(state, testutil.Logger()) - testutil.CreateFulfillment(t, fulfillmentapp, prov.Address, key, depl.Address, gseq, oseq, price) + fulfillment := testutil.CreateFulfillment(t, fulfillmentapp, prov.Address, key, depl.Address, group.Seq, order.Seq, price) check := func( dstate types.Deployment_DeploymentState, @@ -219,9 +228,9 @@ func TestCloseTx_3(t *testing.T) { ostate types.Order_OrderState, fstate types.Fulfillment_FulfillmentState) { assertDeploymentState(t, app, depl.Address, dstate) - assertDeploymentGroupState(t, app, depl.Address, gseq, gstate) - assertOrderState(t, orderapp, depl.Address, gseq, oseq, ostate) - assertFulfillmentState(t, fulfillmentapp, depl.Address, gseq, oseq, prov.Address, fstate) + assertDeploymentGroupState(t, app, group.DeploymentGroupID, gstate) + assertOrderState(t, orderapp, order.OrderID, ostate) + assertFulfillmentState(t, fulfillmentapp, fulfillment.FulfillmentID, fstate) } check(types.Deployment_ACTIVE, types.DeploymentGroup_OPEN, types.Order_OPEN, types.Fulfillment_OPEN) @@ -248,16 +257,16 @@ func TestCloseTx_4(t *testing.T) { orderapp, err := order.NewApp(state, testutil.Logger()) require.NoError(t, err) - testutil.CreateOrder(t, orderapp, account, key, depl.Address, gseq, oseq) + order := testutil.CreateOrder(t, orderapp, account, key, depl.Address, gseq, oseq) providerapp, err := provider.NewApp(state, testutil.Logger()) prov := testutil.CreateProvider(t, providerapp, account, key, nonce) fulfillmentapp, err := fulfillment.NewApp(state, testutil.Logger()) - testutil.CreateFulfillment(t, fulfillmentapp, prov.Address, key, depl.Address, gseq, oseq, price) + fulfillment := testutil.CreateFulfillment(t, fulfillmentapp, prov.Address, key, depl.Address, gseq, oseq, price) leaseapp, err := lease.NewApp(state, testutil.Logger()) - testutil.CreateLease(t, leaseapp, prov.Address, key, depl.Address, gseq, oseq, price) + lease := testutil.CreateLease(t, leaseapp, prov.Address, key, depl.Address, gseq, oseq, price) check := func( dstate types.Deployment_DeploymentState, @@ -266,10 +275,10 @@ func TestCloseTx_4(t *testing.T) { fstate types.Fulfillment_FulfillmentState, lstate types.Lease_LeaseState) { assertDeploymentState(t, app, depl.Address, dstate) - assertDeploymentGroupState(t, app, depl.Address, gseq, gstate) - assertOrderState(t, orderapp, depl.Address, gseq, oseq, ostate) - assertFulfillmentState(t, fulfillmentapp, depl.Address, gseq, oseq, prov.Address, fstate) - assertLeaseState(t, leaseapp, depl.Address, gseq, oseq, prov.Address, lstate) + assertDeploymentGroupState(t, app, order.GroupID(), gstate) + assertOrderState(t, orderapp, order.OrderID, ostate) + assertFulfillmentState(t, fulfillmentapp, fulfillment.FulfillmentID, fstate) + assertLeaseState(t, leaseapp, lease.LeaseID, lstate) } check(types.Deployment_ACTIVE, types.DeploymentGroup_OPEN, types.Order_MATCHED, types.Fulfillment_OPEN, types.Lease_ACTIVE) @@ -301,11 +310,10 @@ func assertDeploymentState( func assertDeploymentGroupState( t *testing.T, app apptypes.Application, - daddr []byte, - gseq uint64, + id types.DeploymentGroupID, gstate types.DeploymentGroup_DeploymentGroupState) { - path := query.DeploymentGroupPath(daddr, gseq) + path := query.DeploymentGroupPath(id) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) @@ -319,12 +327,10 @@ func assertDeploymentGroupState( func assertOrderState( t *testing.T, app apptypes.Application, - daddr []byte, - gseq uint64, - oseq uint64, + id types.OrderID, ostate types.Order_OrderState) { - path := query.OrderPath(daddr, gseq, oseq) + path := query.OrderPath(id) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) @@ -337,13 +343,10 @@ func assertOrderState( func assertFulfillmentState( t *testing.T, app apptypes.Application, - daddr []byte, - gseq uint64, - oseq uint64, - paddr []byte, + id types.FulfillmentID, state types.Fulfillment_FulfillmentState) { - path := query.FulfillmentPath(daddr, gseq, oseq, paddr) + path := query.FulfillmentPath(id) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) @@ -356,14 +359,11 @@ func assertFulfillmentState( func assertLeaseState( t *testing.T, app apptypes.Application, - daddr []byte, - gseq uint64, - oseq uint64, - paddr []byte, + id types.LeaseID, state types.Lease_LeaseState) { // check fulfillment state - path := query.LeasePath(daddr, gseq, oseq, paddr) + path := query.LeasePath(id) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) diff --git a/app/fulfillment/app.go b/app/fulfillment/app.go index 4d5c4de767..747fa37000 100644 --- a/app/fulfillment/app.go +++ b/app/fulfillment/app.go @@ -9,9 +9,9 @@ import ( "github.com/gogo/protobuf/proto" apptypes "github.com/ovrclk/akash/app/types" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/types" - "github.com/ovrclk/akash/types/base" "github.com/ovrclk/akash/types/code" tmtypes "github.com/tendermint/abci/types" ) @@ -79,18 +79,13 @@ func (a *app) Query(req tmtypes.RequestQuery) tmtypes.ResponseQuery { // todo: abstractiion: all queries should have this id := strings.TrimPrefix(req.Path, state.FulfillmentPath) - key, err := base.DecodeString(id) + key, err := keys.ParseFulfillmentPath(id) if err != nil { return tmtypes.ResponseQuery{ Code: code.ERROR, Log: err.Error(), } } - - // id is empty string, get full range - if len(id) == 0 { - return a.doRangeQuery(key) - } return a.doQuery(key) } @@ -149,7 +144,7 @@ func (a *app) doCheckCreateTx(ctx apptypes.Context, tx *types.TxCreateFulfillmen } // ensure order exists - dorder, err := a.State().Order().Get(tx.Deployment, tx.Group, tx.Order) + dorder, err := a.State().Order().Get(tx.OrderID()) if err != nil { return tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -172,7 +167,7 @@ func (a *app) doCheckCreateTx(ctx apptypes.Context, tx *types.TxCreateFulfillmen } // get deployment group - group, err := a.State().DeploymentGroup().Get(tx.Deployment, tx.Group) + group, err := a.State().DeploymentGroup().Get(tx.GroupID()) if err != nil { return tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -197,7 +192,7 @@ func (a *app) doCheckCreateTx(ctx apptypes.Context, tx *types.TxCreateFulfillmen } // ensure there are no other orders for this provider - other, err := a.State().Fulfillment().Get(tx.Deployment, tx.Group, tx.Order, tx.Provider) + other, err := a.State().Fulfillment().Get(tx.FulfillmentID) if err != nil { return tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -224,12 +219,8 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateFulfillm } fulfillment := &types.Fulfillment{ - Deployment: tx.Deployment, - Group: tx.Group, - Order: tx.Order, - Provider: tx.Provider, - Price: tx.Price, - State: types.Fulfillment_OPEN, + FulfillmentID: tx.FulfillmentID, + State: types.Fulfillment_OPEN, } if err := a.State().Fulfillment().Save(fulfillment); err != nil { @@ -247,7 +238,7 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateFulfillm func (a *app) doCheckCloseTx(ctx apptypes.Context, tx *types.TxCloseFulfillment) (*types.Fulfillment, tmtypes.ResponseCheckTx) { // lookup fulfillment - fulfillment, err := a.State().Fulfillment().GetByKey(tx.Fulfillment) + fulfillment, err := a.State().Fulfillment().Get(tx.FulfillmentID) if err != nil { return nil, tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -331,8 +322,8 @@ func (a *app) doDeliverCloseTx(ctx apptypes.Context, tx *types.TxCloseFulfillmen } } -func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { - ful, err := a.State().Fulfillment().GetByKey(key) +func (a *app) doQuery(key keys.Fulfillment) tmtypes.ResponseQuery { + ful, err := a.State().Fulfillment().Get(key.ID()) if err != nil { return tmtypes.ResponseQuery{ @@ -344,7 +335,7 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { if ful == nil { return tmtypes.ResponseQuery{ Code: code.NOT_FOUND, - Log: fmt.Sprintf("fulfillment %x not found", key), + Log: fmt.Sprintf("fulfillment %v not found", key.Path()), } } @@ -361,7 +352,3 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { Height: a.State().Version(), } } - -func (a *app) doRangeQuery(key base.Bytes) tmtypes.ResponseQuery { - return tmtypes.ResponseQuery{} -} diff --git a/app/fulfillment/app_test.go b/app/fulfillment/app_test.go index 4dbba539f2..3f107d2923 100644 --- a/app/fulfillment/app_test.go +++ b/app/fulfillment/app_test.go @@ -29,7 +29,13 @@ func TestAcceptQuery(t *testing.T) { require.NoError(t, err) { - path := query.FulfillmentPath(testutil.DeploymentAddress(t), 0, 0, testutil.Address(t)) + id := types.FulfillmentID{ + Deployment: testutil.DeploymentAddress(t), + Group: 0, + Order: 0, + Provider: testutil.Address(t), + } + path := query.FulfillmentPath(id) assert.True(t, app.AcceptQuery(tmtypes.RequestQuery{Path: path})) } @@ -78,7 +84,7 @@ func createFulfillment(t *testing.T, app apptypes.Application, provider *types.P // create fulfillment fulfillment := testutil.CreateFulfillment(t, app, provider.Address, pkey, deployment, groupSeq, oSeq, price) - path := query.FulfillmentPath(fulfillment.Deployment, fulfillment.Group, fulfillment.Order, fulfillment.Provider) + path := query.FulfillmentPath(fulfillment.FulfillmentID) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) @@ -97,7 +103,7 @@ func createFulfillment(t *testing.T, app apptypes.Application, provider *types.P func closeFulfillment(t *testing.T, app apptypes.Application, key crypto.PrivKey, fulfillment *types.Fulfillment) { testutil.CloseFulfillment(t, app, key, fulfillment) - path := query.FulfillmentPath(fulfillment.Deployment, fulfillment.Group, fulfillment.Order, fulfillment.Provider) + path := query.FulfillmentPath(fulfillment.FulfillmentID) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) diff --git a/app/lease/app.go b/app/lease/app.go index f3fb95d2a4..dc767b973f 100644 --- a/app/lease/app.go +++ b/app/lease/app.go @@ -8,9 +8,9 @@ import ( "github.com/gogo/protobuf/proto" "github.com/ovrclk/akash/app/market" apptypes "github.com/ovrclk/akash/app/types" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/types" - "github.com/ovrclk/akash/types/base" "github.com/ovrclk/akash/types/code" tmtypes "github.com/tendermint/abci/types" tmcommon "github.com/tendermint/tmlibs/common" @@ -79,24 +79,29 @@ func (a *app) Query(req tmtypes.RequestQuery) tmtypes.ResponseQuery { } } - // todo: abstractiion: all queries should have this + // TODO: Partial Key Parsing id := strings.TrimPrefix(req.Path, state.LeasePath) - key, err := base.DecodeString(id) - if err != nil { - return tmtypes.ResponseQuery{ - Code: code.ERROR, - Log: err.Error(), - } - } - // id is empty string, get full range if len(id) == 0 { - return a.doRangeQuery(key) + return a.doRangeQuery() + } + + { + key, err := keys.ParseLeasePath(id) + if err == nil { + return a.doQuery(key) + } } - if len(id) == state.AddressSize*2 { + + key, err := keys.ParseDeploymentPath(id) + if err == nil { return a.doDeploymentQuery(key) } - return a.doQuery(key) + + return tmtypes.ResponseQuery{ + Code: code.ERROR, + Log: err.Error(), + } } func (a *app) doCheckCreateTx(ctx apptypes.Context, tx *types.TxCreateLease) (tmtypes.ResponseCheckTx, *types.Order) { @@ -145,7 +150,7 @@ func (a *app) doCheckCreateTx(ctx apptypes.Context, tx *types.TxCreateLease) (tm } // ensure order exists - order, err := a.State().Order().Get(tx.Deployment, tx.Group, tx.Order) + order, err := a.State().Order().Get(tx.OrderID()) if err != nil { return tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -168,7 +173,7 @@ func (a *app) doCheckCreateTx(ctx apptypes.Context, tx *types.TxCreateLease) (tm } // ensure fulfillment exists - fulfillment, err := a.State().Fulfillment().Get(tx.Deployment, tx.Group, tx.Order, tx.Provider) + fulfillment, err := a.State().Fulfillment().Get(tx.FulfillmentID()) if err != nil { return tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -216,12 +221,9 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateLease) t } lease := &types.Lease{ - Deployment: tx.Deployment, - Group: tx.Group, - Order: tx.Order, - Provider: tx.Provider, - Price: tx.Price, - State: types.Lease_ACTIVE, + LeaseID: tx.LeaseID, + Price: tx.Price, + State: types.Lease_ACTIVE, } if err := a.State().Lease().Save(lease); err != nil { @@ -231,7 +233,7 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateLease) t } } - group, err := a.State().DeploymentGroup().Get(tx.Deployment, tx.Group) + group, err := a.State().DeploymentGroup().Get(tx.GroupID()) if err != nil { return tmtypes.ResponseDeliverTx{ Code: code.ERROR, @@ -245,7 +247,7 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateLease) t } } - orders, err := a.State().Order().ForGroup(group) + orders, err := a.State().Order().ForGroup(group.DeploymentGroupID) if err != nil { return tmtypes.ResponseDeliverTx{ Code: code.ERROR, @@ -275,7 +277,7 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateLease) t tags := apptypes.NewTags(a.Name(), apptypes.TxTypeCreateLease) tags = append(tags, tmcommon.KVPair{Key: []byte(apptypes.TagNameDeployment), Value: lease.Deployment}) - tags = append(tags, tmcommon.KVPair{Key: []byte(apptypes.TagNameLease), Value: state.IDForLease(lease)}) + tags = append(tags, tmcommon.KVPair{Key: []byte(apptypes.TagNameLease), Value: keys.LeaseID(lease.LeaseID).Bytes()}) return tmtypes.ResponseDeliverTx{ Tags: tags, @@ -283,15 +285,9 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateLease) t } func (a *app) doCheckCloseTx(ctx apptypes.Context, tx *types.TxCloseLease) (tmtypes.ResponseCheckTx, *types.Lease) { - if tx.Lease == nil { - return tmtypes.ResponseCheckTx{ - Code: code.INVALID_TRANSACTION, - Log: "empty lease", - }, nil - } // lookup provider - lease, err := a.State().Lease().GetByKey(tx.Lease) + lease, err := a.State().Lease().Get(tx.LeaseID) if err != nil { return tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -324,7 +320,7 @@ func (a *app) doDeliverCloseTx(ctx apptypes.Context, tx *types.TxCloseLease) tmt } } - group, err := a.State().DeploymentGroup().Get(lease.Deployment, lease.Group) + group, err := a.State().DeploymentGroup().Get(lease.GroupID()) if err != nil { return tmtypes.ResponseDeliverTx{ Code: code.ERROR, @@ -338,7 +334,7 @@ func (a *app) doDeliverCloseTx(ctx apptypes.Context, tx *types.TxCloseLease) tmt } } - order, err := a.State().Order().Get(lease.Deployment, lease.Group, lease.Order) + order, err := a.State().Order().Get(lease.OrderID()) if err != nil { return tmtypes.ResponseDeliverTx{ Code: code.ERROR, @@ -377,15 +373,15 @@ func (a *app) doDeliverCloseTx(ctx apptypes.Context, tx *types.TxCloseLease) tmt } tags := apptypes.NewTags(a.Name(), apptypes.TxTypeCloseLease) - tags = append(tags, tmcommon.KVPair{Key: []byte(apptypes.TagNameLease), Value: state.IDForLease(lease)}) + tags = append(tags, tmcommon.KVPair{Key: []byte(apptypes.TagNameLease), Value: keys.LeaseID(lease.LeaseID).Bytes()}) return tmtypes.ResponseDeliverTx{ Tags: tags, } } -func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { - lease, err := a.State().Lease().GetByKey(key) +func (a *app) doQuery(key keys.Lease) tmtypes.ResponseQuery { + lease, err := a.State().Lease().Get(key.ID()) if err != nil { return tmtypes.ResponseQuery{ @@ -397,7 +393,7 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { if lease == nil { return tmtypes.ResponseQuery{ Code: code.NOT_FOUND, - Log: fmt.Sprintf("lease %x not found", key), + Log: fmt.Sprintf("lease %v not found", key.Path()), } } @@ -415,7 +411,7 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { } } -func (a *app) doRangeQuery(key base.Bytes) tmtypes.ResponseQuery { +func (a *app) doRangeQuery() tmtypes.ResponseQuery { items, err := a.State().Lease().All() if err != nil { return tmtypes.ResponseQuery{ @@ -440,8 +436,8 @@ func (a *app) doRangeQuery(key base.Bytes) tmtypes.ResponseQuery { } } -func (a *app) doDeploymentQuery(deployment base.Bytes) tmtypes.ResponseQuery { - items, err := a.State().Lease().ForDeployment(deployment) +func (a *app) doDeploymentQuery(key keys.Deployment) tmtypes.ResponseQuery { + items, err := a.State().Lease().ForDeployment(key.Bytes()) if err != nil { return tmtypes.ResponseQuery{ Code: code.ERROR, diff --git a/app/lease/app_test.go b/app/lease/app_test.go index 79f26953d7..fafadf015f 100644 --- a/app/lease/app_test.go +++ b/app/lease/app_test.go @@ -78,7 +78,7 @@ func TestValidTx(t *testing.T) { lease := testutil.CreateLease(t, app, provider.Address, pkey, daddress, groupSeq, oSeq, price) { - path := query.LeasePath(lease.Deployment, lease.Group, lease.Order, lease.Provider) + path := query.LeasePath(lease.LeaseID) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) @@ -93,10 +93,9 @@ func TestValidTx(t *testing.T) { } // close lease - leaseAddr := state.Lease().IDFor(lease) - testutil.CloseLease(t, app, leaseAddr, pkey) + testutil.CloseLease(t, app, lease.LeaseID, pkey) { - path := query.LeasePath(lease.Deployment, lease.Group, lease.Order, lease.Provider) + path := query.LeasePath(lease.LeaseID) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) diff --git a/app/market/engine.go b/app/market/engine.go index 2fcb894669..75e16599a6 100644 --- a/app/market/engine.go +++ b/app/market/engine.go @@ -120,7 +120,7 @@ func (e engine) processDeployment(state state.State, w txBuffer, deployment type } // process current orders - orders, err := state.Order().ForGroup(group) + orders, err := state.Order().ForGroup(group.DeploymentGroupID) if err != nil { return err } @@ -145,10 +145,12 @@ func (e engine) processDeployment(state state.State, w txBuffer, deployment type // if no active order for the group emit create tx if !activeFound { w.put(&types.TxCreateOrder{ - Deployment: deployment.Address, - Group: group.GetSeq(), - Seq: nextSeq, - EndAt: group.OrderTTL + height, + OrderID: types.OrderID{ + Deployment: deployment.Address, + Group: group.GetSeq(), + Seq: nextSeq, + }, + EndAt: group.OrderTTL + height, }) nextSeq++ } @@ -158,7 +160,7 @@ func (e engine) processDeployment(state state.State, w txBuffer, deployment type } func BestFulfillment(state state.State, order *types.Order) (*types.Fulfillment, error) { - fulfillments, err := state.Fulfillment().ForOrder(order) + fulfillments, err := state.Fulfillment().ForOrder(order.OrderID) if err != nil { return nil, err } @@ -200,11 +202,8 @@ func (e engine) processOrder(state state.State, w txBuffer, order *types.Order) } w.put(&types.TxCreateLease{ - Deployment: fulfillment.Deployment, - Group: fulfillment.Group, - Order: fulfillment.Order, - Provider: fulfillment.Provider, - Price: fulfillment.Price, + LeaseID: fulfillment.LeaseID(), + Price: fulfillment.Price, }) return nil diff --git a/app/market/engine_test.go b/app/market/engine_test.go index df5488788b..3bc7f7661c 100644 --- a/app/market/engine_test.go +++ b/app/market/engine_test.go @@ -45,11 +45,9 @@ func testCreateOrder(t *testing.T, state state.State, tenant *types.Account, dep require.Equal(t, deployment.Address, tx.Deployment) require.Equal(t, groups.GetItems()[0].Seq, tx.Group) order := &types.Order{ - Deployment: tx.Deployment, - Group: tx.Group, - Seq: tx.Seq, - EndAt: tx.EndAt, - State: types.Order_OPEN, + OrderID: tx.OrderID, + EndAt: tx.EndAt, + State: types.Order_OPEN, } require.NoError(t, state.Order().Save(order)) @@ -70,12 +68,9 @@ func testCreateLease(t *testing.T, state state.State, provider *types.Provider, leaseTx, ok := txs[0].(*types.TxCreateLease) lease := &types.Lease{ - Deployment: leaseTx.Deployment, - Group: leaseTx.Group, - Order: leaseTx.Order, - Provider: leaseTx.Provider, - Price: leaseTx.Price, - State: types.Lease_ACTIVE, + LeaseID: leaseTx.LeaseID, + Price: leaseTx.Price, + State: types.Lease_ACTIVE, } require.True(t, ok) require.NoError(t, state.Lease().Save(lease)) diff --git a/app/market/facilitator_test.go b/app/market/facilitator_test.go index 24c68f556d..b08f609b54 100644 --- a/app/market/facilitator_test.go +++ b/app/market/facilitator_test.go @@ -26,7 +26,9 @@ func TestFacilitator(t *testing.T) { daddr := state.DeploymentAddress(account.Address, nonce) tx := &types.TxCreateOrder{ - Deployment: daddr, + OrderID: types.OrderID{ + Deployment: daddr, + }, } txs := []interface{}{tx} diff --git a/app/order/app.go b/app/order/app.go index 8e55dfe22e..29d240490e 100644 --- a/app/order/app.go +++ b/app/order/app.go @@ -6,9 +6,9 @@ import ( "github.com/gogo/protobuf/proto" apptypes "github.com/ovrclk/akash/app/types" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/types" - "github.com/ovrclk/akash/types/base" "github.com/ovrclk/akash/types/code" tmtypes "github.com/tendermint/abci/types" "github.com/tendermint/tmlibs/log" @@ -68,26 +68,25 @@ func (a *app) Query(req tmtypes.RequestQuery) tmtypes.ResponseQuery { } } - // todo: abstractiion: all queries should have this + // TODO: Partial Key Parsing id := strings.TrimPrefix(req.Path, state.OrderPath) - key, err := base.DecodeString(id) + if len(id) == 0 { + return a.doRangeQuery() + } + + key, err := keys.ParseOrderPath(id) if err != nil { return tmtypes.ResponseQuery{ Code: code.ERROR, Log: err.Error(), } } - - // id is empty string, get full range - if len(id) == 0 { - return a.doRangeQuery(key) - } return a.doQuery(key) } -func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { +func (a *app) doQuery(key keys.Order) tmtypes.ResponseQuery { - depo, err := a.State().Order().GetByKey(key) + depo, err := a.State().Order().Get(key.ID()) if err != nil { return tmtypes.ResponseQuery{ @@ -99,7 +98,7 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { if depo == nil { return tmtypes.ResponseQuery{ Code: code.NOT_FOUND, - Log: fmt.Sprintf("order %x not found", key), + Log: fmt.Sprintf("order %v not found", key.Path()), } } @@ -117,7 +116,7 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { } } -func (a *app) doRangeQuery(key base.Bytes) tmtypes.ResponseQuery { +func (a *app) doRangeQuery() tmtypes.ResponseQuery { items, err := a.State().Order().All() if err != nil { return tmtypes.ResponseQuery{ @@ -178,7 +177,7 @@ func (a *app) doCheckCreateTx(ctx apptypes.Context, tx *types.TxCreateOrder) tmt } // ensure deployment group exists - group, err := a.State().DeploymentGroup().Get(tx.Deployment, tx.Group) + group, err := a.State().DeploymentGroup().Get(tx.GroupID()) if err != nil { return tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -201,7 +200,7 @@ func (a *app) doCheckCreateTx(ctx apptypes.Context, tx *types.TxCreateOrder) tmt } // ensure no other open orders - others, err := a.State().Order().ForGroup(group) + others, err := a.State().Order().ForGroup(group.DeploymentGroupID) if err != nil { return tmtypes.ResponseCheckTx{ Code: code.ERROR, @@ -235,11 +234,9 @@ func (a *app) doDeliverCreateTx(ctx apptypes.Context, tx *types.TxCreateOrder) t oseq.Advance() order := &types.Order{ - Deployment: tx.Deployment, - Group: tx.Group, - Seq: tx.Seq, - EndAt: tx.EndAt, - State: types.Order_OPEN, + OrderID: tx.OrderID, + EndAt: tx.EndAt, + State: types.Order_OPEN, } // order.Order = oseq.Advance() diff --git a/app/order/app_test.go b/app/order/app_test.go index 45d62905b0..b982e1c764 100644 --- a/app/order/app_test.go +++ b/app/order/app_test.go @@ -57,16 +57,18 @@ func TestTx(t *testing.T) { require.NoError(t, err) account, key := testutil.CreateAccount(t, state_) - deployment, groups := testutil.CreateDeployment(t, dapp, account, key, 10) + deployment, groups := testutil.CreateDeployment(t, dapp, account, key, 1) orderSeq := uint64(0) testutil.CreateOrder(t, app, account, key, deployment.Address, groups.GetItems()[0].Seq, orderSeq) - orders, err := state_.Order().ForGroup(groups.GetItems()[0]) + orders, err := state_.Order().ForGroup(groups.GetItems()[0].DeploymentGroupID) require.NoError(t, err) require.Len(t, orders, 1) - path := query.OrderPath(deployment.Address, groups.GetItems()[0].Seq, orderSeq) + order := orders[0] + + path := query.OrderPath(order.OrderID) resp := app.Query(tmtypes.RequestQuery{Path: path}) assert.Empty(t, resp.Log) require.True(t, resp.IsOK()) diff --git a/app/provider/app.go b/app/provider/app.go index 7fe2d85b8d..fa8e795d11 100644 --- a/app/provider/app.go +++ b/app/provider/app.go @@ -41,8 +41,12 @@ func (a *app) Query(req tmtypes.RequestQuery) tmtypes.ResponseQuery { } } - // todo: abstractiion: all queries should have this + // TODO: Partial Key Parsing id := strings.TrimPrefix(req.Path, state.ProviderPath) + if len(id) == 0 { + return a.doRangeQuery() + } + key, err := base.DecodeString(id) if err != nil { return tmtypes.ResponseQuery{ @@ -50,11 +54,6 @@ func (a *app) Query(req tmtypes.RequestQuery) tmtypes.ResponseQuery { Log: err.Error(), } } - - // id is empty string, get full range - if len(id) == 0 { - return a.doRangeQuery(key) - } return a.doQuery(key) } @@ -120,7 +119,7 @@ func (a *app) doQuery(key base.Bytes) tmtypes.ResponseQuery { } } -func (a *app) doRangeQuery(key base.Bytes) tmtypes.ResponseQuery { +func (a *app) doRangeQuery() tmtypes.ResponseQuery { dcs, err := a.State().Provider().GetMaxRange() if err != nil { return tmtypes.ResponseQuery{ diff --git a/cmd/akash/deployment.go b/cmd/akash/deployment.go index d6a2f43529..ca2f246674 100644 --- a/cmd/akash/deployment.go +++ b/cmd/akash/deployment.go @@ -8,10 +8,10 @@ import ( "github.com/ovrclk/akash/cmd/akash/context" "github.com/ovrclk/akash/cmd/akash/query" "github.com/ovrclk/akash/cmd/common" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/manifest" "github.com/ovrclk/akash/marketplace" "github.com/ovrclk/akash/sdl" - "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/types" "github.com/ovrclk/akash/types/base" . "github.com/ovrclk/akash/util" @@ -102,13 +102,13 @@ func createDeployment(ctx context.Context, cmd *cobra.Command, args []string) er OnTxCreateFulfillment(func(tx *types.TxCreateFulfillment) { if bytes.Equal(tx.Deployment, address) { fmt.Printf("Group %v/%v Fulfillment: %v\n", tx.Group, len(groups), - X(state.FulfillmentID(tx.Deployment, tx.Group, tx.Order, tx.Provider))) + keys.FulfillmentID(tx.FulfillmentID).Path()) } }). OnTxCreateLease(func(tx *types.TxCreateLease) { if bytes.Equal(tx.Deployment, address) { fmt.Printf("Group %v/%v Lease: %v\n", tx.Group, len(groups), - X(state.FulfillmentID(tx.Deployment, tx.Group, tx.Order, tx.Provider))) + keys.LeaseID(tx.LeaseID).Path()) // get lease provider prov, err := query.Provider(ctx, tx.Provider) if err != nil { diff --git a/cmd/akash/marketplace.go b/cmd/akash/marketplace.go index c7d71907e5..8b12d05539 100644 --- a/cmd/akash/marketplace.go +++ b/cmd/akash/marketplace.go @@ -5,6 +5,7 @@ import ( "github.com/ovrclk/akash/cmd/akash/context" "github.com/ovrclk/akash/cmd/common" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/marketplace" "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/types" @@ -61,10 +62,10 @@ func marketplaceMonitorHandler() marketplace.Handler { fmt.Printf("DEPLOYMENT CLOSED\t%v\n", X(tx.Deployment)) }). OnTxCloseFulfillment(func(tx *types.TxCloseFulfillment) { - fmt.Printf("FULFILLMENT CLOSED\t%v\n", X(tx.Fulfillment)) + fmt.Printf("FULFILLMENT CLOSED\t%v\n", keys.FulfillmentID(tx.FulfillmentID).Path()) }). OnTxCloseLease(func(tx *types.TxCloseLease) { - fmt.Printf("LEASE CLOSED\t%v\n", X(tx.Lease)) + fmt.Printf("LEASE CLOSED\t%v\n", keys.LeaseID(tx.LeaseID).Path()) }). Create() } diff --git a/cmd/akash/provider.go b/cmd/akash/provider.go index 0c7a5915bc..fbc84f0296 100644 --- a/cmd/akash/provider.go +++ b/cmd/akash/provider.go @@ -5,16 +5,15 @@ import ( gcontext "context" "fmt" "math/rand" - "strconv" "github.com/ovrclk/akash/cmd/akash/constants" "github.com/ovrclk/akash/cmd/akash/context" "github.com/ovrclk/akash/cmd/akash/query" "github.com/ovrclk/akash/cmd/common" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/manifest" "github.com/ovrclk/akash/marketplace" qp "github.com/ovrclk/akash/query" - "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/types" "github.com/ovrclk/akash/types/base" "github.com/ovrclk/akash/types/provider" @@ -138,12 +137,12 @@ func doProviderRunCommand(ctx context.Context, cmd *cobra.Command, args []string return err } - deployments := make(map[string][]string) + deployments := make(map[string][]types.LeaseID) handler := marketplace.NewBuilder(). OnTxCreateOrder(func(tx *types.TxCreateOrder) { - price, err := getPrice(ctx, tx.Deployment, tx.Group) + price, err := getPrice(ctx, tx.OrderID) if err != nil { ctx.Log().Error("error getting price", "error", err) return @@ -153,18 +152,20 @@ func doProviderRunCommand(ctx context.Context, cmd *cobra.Command, args []string price = uint32(rand.Int31n(int32(price) + 1)) ordertx := &types.TxCreateFulfillment{ - Deployment: tx.Deployment, - Group: tx.Group, - Order: tx.Seq, - Provider: provider, - Price: price, + FulfillmentID: types.FulfillmentID{ + Deployment: tx.Deployment, + Group: tx.Group, + Order: tx.Seq, + Provider: provider, + }, + Price: price, } - fmt.Printf("Bidding on order: %v/%v/%v\n", - X(tx.Deployment), tx.Group, tx.Seq) + fmt.Printf("Bidding on order: %v\n", + keys.OrderID(tx.OrderID).Path()) fmt.Printf("Fulfillment: %v\n", - X(state.FulfillmentID(tx.Deployment, tx.Group, tx.Seq, provider))) + keys.FulfillmentID(ordertx.FulfillmentID).Path()) _, err = txclient.BroadcastTxCommit(ordertx) if err != nil { @@ -176,28 +177,27 @@ func doProviderRunCommand(ctx context.Context, cmd *cobra.Command, args []string OnTxCreateLease(func(tx *types.TxCreateLease) { leaseProvider, _ := tx.Provider.Marshal() if bytes.Equal(leaseProvider, provider) { - lease := X(state.LeaseID(tx.Deployment, tx.Group, tx.Order, tx.Provider)) leases, _ := deployments[tx.Deployment.EncodeString()] - deployments[tx.Deployment.EncodeString()] = append(leases, lease) - fmt.Printf("Won lease for order: %v/%v/%v\n", - X(tx.Deployment), tx.Group, tx.Order) + deployments[tx.Deployment.EncodeString()] = append(leases, tx.LeaseID) + fmt.Printf("Won lease for order: %v\n", + keys.LeaseID(tx.LeaseID).Path()) } }). OnTxCloseDeployment(func(tx *types.TxCloseDeployment) { leases, ok := deployments[tx.Deployment.EncodeString()] if ok { for _, lease := range leases { - fmt.Printf("Closed lease %v\n", lease) + fmt.Printf("Closed lease %v\n", keys.LeaseID(lease).Path()) } } }).Create() return common.MonitorMarketplace(ctx.Log(), ctx.Client(), handler) } -func getPrice(ctx context.Context, addr base.Bytes, seq uint64) (uint32, error) { +func getPrice(ctx context.Context, id types.OrderID) (uint32, error) { // get deployment group price := uint32(0) - path := qp.DeploymentGroupPath(addr, seq) + path := qp.DeploymentGroupPath(id.GroupID()) group := new(types.DeploymentGroup) result, err := query.Query(ctx, path) if err != nil { @@ -230,13 +230,13 @@ func doCloseFulfillmentCommand(ctx context.Context, cmd *cobra.Command, args []s return err } - fulfillment, err := base.DecodeString(args[0]) + key, err := keys.ParseFulfillmentPath(args[0]) if err != nil { return err } _, err = txclient.BroadcastTxCommit(&types.TxCloseFulfillment{ - Fulfillment: fulfillment, + FulfillmentID: key.ID(), }) return err } @@ -261,30 +261,13 @@ func doCloseLeaseCommand(ctx context.Context, cmd *cobra.Command, args []string) return err } - deployment, err := base.DecodeString(args[0]) + key, err := keys.ParseLeasePath(args[0]) if err != nil { return err } - group, err := strconv.ParseUint(args[1], 10, 64) - if err != nil { - return err - } - - order, err := strconv.ParseUint(args[2], 10, 64) - if err != nil { - return err - } - - provider, err := base.DecodeString(args[3]) - if err != nil { - return err - } - - lease := state.LeaseID(deployment, group, order, provider) - _, err = txclient.BroadcastTxCommit(&types.TxCloseLease{ - Lease: lease, + LeaseID: key.ID(), }) return err diff --git a/keys/keys.go b/keys/keys.go new file mode 100644 index 0000000000..9b4f98d0a6 --- /dev/null +++ b/keys/keys.go @@ -0,0 +1,169 @@ +package keys + +import ( + "bytes" + "encoding/binary" + "strconv" + + "github.com/ovrclk/akash/types" + "github.com/ovrclk/akash/types/base" + "github.com/ovrclk/akash/util" +) + +// XXX: interim hack (iteration!) + +type Key interface { + Path() string + Bytes() []byte +} + +type Deployment base.Bytes + +func DeploymentID(id base.Bytes) Deployment { + return Deployment(id) +} + +func (k Deployment) ID() base.Bytes { + return base.Bytes(k) +} + +func (k Deployment) Bytes() []byte { + return k +} + +func (k Deployment) Path() string { + return util.X(k) +} + +type DeploymentGroup struct { + types.DeploymentGroupID +} + +func DeploymentGroupID(id types.DeploymentGroupID) DeploymentGroup { + return DeploymentGroup{id} +} + +func (k DeploymentGroup) ID() types.DeploymentGroupID { + return k.DeploymentGroupID +} + +func (k DeploymentGroup) Bytes() []byte { + buf := new(bytes.Buffer) + buf.Write(k.Deployment) + binary.Write(buf, binary.BigEndian, k.Seq) + return buf.Bytes() +} + +func (k DeploymentGroup) Path() string { + return util.X(k.Deployment) + "/" + strconv.FormatUint(k.Seq, 10) +} + +type Order struct { + types.OrderID +} + +func OrderID(id types.OrderID) Order { + return Order{id} +} + +func (k Order) ID() types.OrderID { + return k.OrderID +} + +func (k Order) Bytes() []byte { + buf := new(bytes.Buffer) + buf.Write(k.Deployment) + binary.Write(buf, binary.BigEndian, k.Group) + binary.Write(buf, binary.BigEndian, k.Seq) + return buf.Bytes() +} + +func (k Order) Path() string { + return util.X(k.Deployment) + "/" + + strconv.FormatUint(k.Group, 10) + "/" + + strconv.FormatUint(k.Seq, 10) +} + +func (k Order) GroupKey() DeploymentGroup { + return DeploymentGroupID(types.DeploymentGroupID{ + Deployment: k.Deployment, + Seq: k.Group, + }) +} + +type Fulfillment struct { + types.FulfillmentID +} + +func FulfillmentID(id types.FulfillmentID) Fulfillment { + return Fulfillment{id} +} + +func (k Fulfillment) ID() types.FulfillmentID { + return k.FulfillmentID +} + +func (k Fulfillment) Bytes() []byte { + buf := new(bytes.Buffer) + buf.Write(k.Deployment) + binary.Write(buf, binary.BigEndian, k.Group) + binary.Write(buf, binary.BigEndian, k.Order) + buf.Write(k.Provider) + return buf.Bytes() +} + +func (k Fulfillment) Path() string { + return util.X(k.Deployment) + "/" + + strconv.FormatUint(k.Group, 10) + "/" + + strconv.FormatUint(k.Order, 10) + "/" + + util.X(k.Provider) +} + +func (k Fulfillment) OrderKey() Order { + return OrderID(types.OrderID{ + Deployment: k.Deployment, + Group: k.Group, + Seq: k.Order, + }) +} + +func (k Fulfillment) GroupKey() DeploymentGroup { + return k.OrderKey().GroupKey() +} + +type Lease struct { + types.LeaseID +} + +func LeaseID(id types.LeaseID) Lease { + return Lease{id} +} + +func (k Lease) ID() types.LeaseID { + return k.LeaseID +} + +func (k Lease) Bytes() []byte { + return k.FulfillmentKey().Bytes() +} + +func (k Lease) Path() string { + return k.FulfillmentKey().Path() +} + +func (k Lease) FulfillmentKey() Fulfillment { + return FulfillmentID(types.FulfillmentID{ + Deployment: k.Deployment, + Group: k.Group, + Order: k.Order, + Provider: k.Provider, + }) +} + +func (k Lease) OrderKey() Order { + return k.FulfillmentKey().OrderKey() +} + +func (k Lease) GroupKey() DeploymentGroup { + return k.FulfillmentKey().GroupKey() +} diff --git a/keys/parse.go b/keys/parse.go new file mode 100644 index 0000000000..5e3f9e79bc --- /dev/null +++ b/keys/parse.go @@ -0,0 +1,95 @@ +package keys + +import ( + "fmt" + "strconv" + "strings" + + "github.com/ovrclk/akash/types" + "github.com/ovrclk/akash/types/base" +) + +// XXX: interim hack (iteration!) + +func ParseDeploymentPath(buf string) (Deployment, error) { + obj, err := base.DecodeString(buf) + return Deployment(obj), err +} + +func ParseGroupPath(buf string) (DeploymentGroup, error) { + var err error + obj := DeploymentGroup{} + parts := strings.Split(buf, "/") + + if len(parts) != 2 { + return obj, fmt.Errorf("invalid group path '%v': truncated", buf) + } + + obj.Deployment, err = base.DecodeString(parts[0]) + if err != nil { + return obj, err + } + + obj.Seq, err = strconv.ParseUint(parts[1], 10, 64) + if err != nil { + return obj, err + } + + return obj, nil +} + +func ParseOrderPath(buf string) (Order, error) { + obj := Order{} + parts := strings.Split(buf, "/") + + if len(parts) != 3 { + return obj, fmt.Errorf("invalid order path '%v': truncated", buf) + } + + group, err := ParseGroupPath(strings.Join(parts[0:2], "/")) + if err != nil { + return obj, fmt.Errorf("invalid order path %v: %v", buf, err) + } + + obj.Deployment = group.Deployment + obj.Group = group.Seq + + obj.Seq, err = strconv.ParseUint(parts[2], 10, 64) + if err != nil { + return obj, fmt.Errorf("invalid order path '%v': bad sequence %v", buf, parts[2]) + } + + return obj, nil +} + +func ParseFulfillmentPath(buf string) (Fulfillment, error) { + obj := Fulfillment{} + parts := strings.Split(buf, "/") + + if len(parts) != 4 { + return obj, fmt.Errorf("invalid fulfillment path '%v': truncated", buf) + } + + order, err := ParseOrderPath(strings.Join(parts[0:3], "/")) + if err != nil { + return obj, fmt.Errorf("invalid fulfillment path '%v': %v", buf, err) + } + + obj.Deployment = order.Deployment + obj.Group = order.Group + obj.Order = order.Seq + + obj.Provider, err = base.DecodeString(parts[3]) + + return obj, err +} + +func ParseLeasePath(buf string) (Lease, error) { + obj, err := ParseFulfillmentPath(buf) + return LeaseID(types.LeaseID{ + Deployment: obj.Deployment, + Group: obj.Group, + Order: obj.Order, + Provider: obj.Provider, + }), err +} diff --git a/query/query.go b/query/query.go index c244372d87..872753a598 100644 --- a/query/query.go +++ b/query/query.go @@ -1,7 +1,9 @@ package query import ( + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/state" + "github.com/ovrclk/akash/types" . "github.com/ovrclk/akash/util" ) @@ -17,18 +19,18 @@ func DeploymentPath(address []byte) string { return state.DeploymentPath + X(address) } -func DeploymentGroupPath(daddr []byte, gseq uint64) string { - return state.DeploymentGroupPath + X(state.DeploymentGroupID(daddr, gseq)) +func DeploymentGroupPath(id types.DeploymentGroupID) string { + return state.DeploymentGroupPath + keys.DeploymentGroupID(id).Path() } -func OrderPath(daddr []byte, gseq uint64, oseq uint64) string { - return state.OrderPath + X(state.OrderID(daddr, gseq, oseq)) +func OrderPath(id types.OrderID) string { + return state.OrderPath + keys.OrderID(id).Path() } -func FulfillmentPath(daddr []byte, gseq uint64, oseq uint64, paddr []byte) string { - return state.FulfillmentPath + X(state.FulfillmentID(daddr, gseq, oseq, paddr)) +func FulfillmentPath(id types.FulfillmentID) string { + return state.FulfillmentPath + keys.FulfillmentID(id).Path() } -func LeasePath(daddr []byte, gseq uint64, oseq uint64, paddr []byte) string { - return state.LeasePath + X(state.LeaseID(daddr, gseq, oseq, paddr)) +func LeasePath(id types.LeaseID) string { + return state.LeasePath + keys.LeaseID(id).Path() } diff --git a/state/deployment_group.go b/state/deployment_group.go index 7dfe66d2cf..9dbcb8f066 100644 --- a/state/deployment_group.go +++ b/state/deployment_group.go @@ -4,16 +4,15 @@ import ( "math" "github.com/gogo/protobuf/proto" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/types" "github.com/ovrclk/akash/types/base" ) type DeploymentGroupAdapter interface { Save(*types.DeploymentGroup) error - Get(addr base.Bytes, seq uint64) (*types.DeploymentGroup, error) - GetByKey(addr base.Bytes) (*types.DeploymentGroup, error) + Get(id types.DeploymentGroupID) (*types.DeploymentGroup, error) ForDeployment(addr base.Bytes) ([]*types.DeploymentGroup, error) - KeyFor(base.Bytes) base.Bytes } func NewDeploymentGroupAdapter(db DB) DeploymentGroupAdapter { @@ -25,25 +24,18 @@ type deploymentGroupAdapter struct { } func (a *deploymentGroupAdapter) Save(obj *types.DeploymentGroup) error { - path := a.KeyFor(a.IDFor(obj)) + path := a.keyFor(obj.DeploymentGroupID) return saveObject(a.db, path, obj) } -func (a *deploymentGroupAdapter) Get(addr base.Bytes, seq uint64) (*types.DeploymentGroup, error) { - path := a.KeyFor(DeploymentGroupID(addr, seq)) +func (a *deploymentGroupAdapter) Get(id types.DeploymentGroupID) (*types.DeploymentGroup, error) { + path := a.keyFor(id) buf := a.db.Get(path) - obj := new(types.DeploymentGroup) - return obj, proto.Unmarshal(buf, obj) -} - -func (a *deploymentGroupAdapter) GetByKey(address base.Bytes) (*types.DeploymentGroup, error) { - obj := types.DeploymentGroup{} - key := a.KeyFor(address) - buf := a.db.Get(key) if buf == nil { return nil, nil } - return &obj, obj.Unmarshal(buf) + obj := new(types.DeploymentGroup) + return obj, proto.Unmarshal(buf, obj) } func (a *deploymentGroupAdapter) ForDeployment(deployment base.Bytes) ([]*types.DeploymentGroup, error) { @@ -68,22 +60,21 @@ func (a *deploymentGroupAdapter) ForDeployment(deployment base.Bytes) ([]*types. return items, nil } -// /deployment-groups/{deployment-address}{group-sequence} -func (a *deploymentGroupAdapter) KeyFor(id base.Bytes) base.Bytes { - return append(base.Bytes(DeploymentGroupPath), id...) -} - -// {deployment-address}{group-sequence} -func (a *deploymentGroupAdapter) IDFor(obj *types.DeploymentGroup) []byte { - return DeploymentGroupID(obj.Deployment, obj.GetSeq()) +func (a *deploymentGroupAdapter) keyFor(id types.DeploymentGroupID) base.Bytes { + key := keys.DeploymentGroupID(id).Bytes() + return append(base.Bytes(DeploymentGroupPath), key...) } -// /deployment-groups/{deployment-address}{0} func (a *deploymentGroupAdapter) deploymentMinRange(deployment []byte) []byte { - return a.KeyFor(DeploymentGroupID(deployment, 0)) + return a.keyFor(types.DeploymentGroupID{ + Deployment: deployment, + Seq: 0, + }) } -// /deployment-groups/{deployment-address}{max-uint} func (a *deploymentGroupAdapter) deploymentMaxRange(deployment []byte) []byte { - return a.KeyFor(DeploymentGroupID(deployment, math.MaxUint64)) + return a.keyFor(types.DeploymentGroupID{ + Deployment: deployment, + Seq: math.MaxUint64, + }) } diff --git a/state/fulfillment.go b/state/fulfillment.go index 01fe55f8c9..f55369ec2d 100644 --- a/state/fulfillment.go +++ b/state/fulfillment.go @@ -4,19 +4,17 @@ import ( "math" "github.com/gogo/protobuf/proto" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/types" "github.com/ovrclk/akash/types/base" ) type FulfillmentAdapter interface { Save(*types.Fulfillment) error - Get(daddr base.Bytes, group uint64, order uint64, paddr base.Bytes) (*types.Fulfillment, error) - GetByKey(address base.Bytes) (*types.Fulfillment, error) + Get(id types.FulfillmentID) (*types.Fulfillment, error) ForDeployment(base.Bytes) ([]*types.Fulfillment, error) - ForGroup(*types.DeploymentGroup) ([]*types.Fulfillment, error) - ForOrder(*types.Order) ([]*types.Fulfillment, error) - IDFor(*types.Fulfillment) []byte - KeyFor(id []byte) []byte + ForGroup(types.DeploymentGroupID) ([]*types.Fulfillment, error) + ForOrder(types.OrderID) ([]*types.Fulfillment, error) } func NewFulfillmentAdapter(db DB) FulfillmentAdapter { @@ -28,12 +26,12 @@ type fulfillmentAdapter struct { } func (a *fulfillmentAdapter) Save(obj *types.Fulfillment) error { - path := a.KeyFor(a.IDFor(obj)) + path := a.keyFor(obj.FulfillmentID) return saveObject(a.db, path, obj) } -func (a *fulfillmentAdapter) Get(daddr base.Bytes, group uint64, order uint64, paddr base.Bytes) (*types.Fulfillment, error) { - path := a.KeyFor(FulfillmentID(daddr, group, order, paddr)) +func (a *fulfillmentAdapter) Get(id types.FulfillmentID) (*types.Fulfillment, error) { + path := a.keyFor(id) buf := a.db.Get(path) if buf == nil { return nil, nil @@ -42,72 +40,75 @@ func (a *fulfillmentAdapter) Get(daddr base.Bytes, group uint64, order uint64, p return obj, proto.Unmarshal(buf, obj) } -func (a *fulfillmentAdapter) GetByKey(address base.Bytes) (*types.Fulfillment, error) { - ful := types.Fulfillment{} - key := a.KeyFor(address) - buf := a.db.Get(key) - if buf == nil { - return nil, nil - } - return &ful, ful.Unmarshal(buf) -} - func (a *fulfillmentAdapter) ForDeployment(deployment base.Bytes) ([]*types.Fulfillment, error) { min := a.deploymentMinRange(deployment) max := a.deploymentMaxRange(deployment) return a.forRange(min, max) } -func (a *fulfillmentAdapter) ForGroup(group *types.DeploymentGroup) ([]*types.Fulfillment, error) { - min := a.groupMinRange(group) - max := a.groupMaxRange(group) +func (a *fulfillmentAdapter) ForGroup(id types.DeploymentGroupID) ([]*types.Fulfillment, error) { + min := a.groupMinRange(id) + max := a.groupMaxRange(id) return a.forRange(min, max) } -func (a *fulfillmentAdapter) ForOrder(order *types.Order) ([]*types.Fulfillment, error) { +func (a *fulfillmentAdapter) ForOrder(order types.OrderID) ([]*types.Fulfillment, error) { min := a.orderMinRange(order) max := a.orderMaxRange(order) return a.forRange(min, max) } -// /fulfillment-orders/{deployment-address}{group-sequence}{order-sequence}{provider-address} -func (a *fulfillmentAdapter) KeyFor(id []byte) []byte { - return append([]byte(FulfillmentPath), id...) -} - -// {deployment-address}{group-sequence}{order-sequence}{provider-address} -func (a *fulfillmentAdapter) IDFor(obj *types.Fulfillment) []byte { - return FulfillmentID(obj.Deployment, obj.GetGroup(), obj.GetOrder(), obj.Provider) +func (a *fulfillmentAdapter) keyFor(id types.FulfillmentID) []byte { + path := keys.FulfillmentID(id).Bytes() + return append([]byte(FulfillmentPath), path...) } -// /fulfillment-orders/{deployment-address}{group-sequence}{order-sequence} func (a *fulfillmentAdapter) deploymentMinRange(deployment base.Bytes) []byte { - return a.KeyFor(FulfillmentID(deployment, 0, 0, []byte{})) + return a.keyFor(types.FulfillmentID{ + Deployment: deployment, + }) } -// /fulfillment-orders/{deployment-address}{group-sequence}{max-order-sequence}{max-address} func (a *fulfillmentAdapter) deploymentMaxRange(deployment base.Bytes) []byte { - return a.KeyFor(FulfillmentID(deployment, math.MaxUint64, math.MaxUint64, MaxAddress())) -} - -// /fulfillment-orders/{deployment-address}{group-sequence}{order-sequence} -func (a *fulfillmentAdapter) groupMinRange(group *types.DeploymentGroup) []byte { - return a.KeyFor(FulfillmentID(group.Deployment, group.GetSeq(), 0, []byte{})) -} - -// /fulfillment-orders/{deployment-address}{group-sequence}{max-order-sequence}{max-address} -func (a *fulfillmentAdapter) groupMaxRange(group *types.DeploymentGroup) []byte { - return a.KeyFor(FulfillmentID(group.Deployment, group.GetSeq(), math.MaxUint64, MaxAddress())) -} - -// /fulfillment-orders/{deployment-address}{group-sequence}{order-sequence} -func (a *fulfillmentAdapter) orderMinRange(order *types.Order) []byte { - return a.KeyFor(FulfillmentID(order.Deployment, order.GetGroup(), order.GetSeq(), []byte{})) -} - -// /fulfillment-orders/{deployment-address}{group-sequence}{order-sequence}{max-address} -func (a *fulfillmentAdapter) orderMaxRange(order *types.Order) []byte { - return a.KeyFor(FulfillmentID(order.Deployment, order.GetGroup(), order.GetSeq(), MaxAddress())) + return a.keyFor(types.FulfillmentID{ + Deployment: deployment, + Group: math.MaxUint64, + Order: math.MaxUint64, + Provider: MaxAddress(), + }) +} + +func (a *fulfillmentAdapter) groupMinRange(id types.DeploymentGroupID) []byte { + return a.keyFor(types.FulfillmentID{ + Deployment: id.Deployment, + Group: id.Seq, + }) +} + +func (a *fulfillmentAdapter) groupMaxRange(id types.DeploymentGroupID) []byte { + return a.keyFor(types.FulfillmentID{ + Deployment: id.Deployment, + Group: id.Seq, + Order: math.MaxUint64, + Provider: MaxAddress(), + }) +} + +func (a *fulfillmentAdapter) orderMinRange(id types.OrderID) []byte { + return a.keyFor(types.FulfillmentID{ + Deployment: id.Deployment, + Group: id.Group, + Order: id.Seq, + }) +} + +func (a *fulfillmentAdapter) orderMaxRange(id types.OrderID) []byte { + return a.keyFor(types.FulfillmentID{ + Deployment: id.Deployment, + Group: id.Group, + Order: id.Seq, + Provider: MaxAddress(), + }) } func (a *fulfillmentAdapter) forRange(min, max []byte) ([]*types.Fulfillment, error) { diff --git a/state/id.go b/state/id.go index 42a345541b..f82d68eda7 100644 --- a/state/id.go +++ b/state/id.go @@ -4,55 +4,8 @@ import ( "bytes" "crypto/sha256" "encoding/binary" - - "github.com/ovrclk/akash/types" ) -// {deployment-address}{group-sequence-id} -func DeploymentGroupID(daddr []byte, gseq uint64) []byte { - buf := new(bytes.Buffer) - buf.Write(daddr) - binary.Write(buf, binary.BigEndian, gseq) - return buf.Bytes() -} - -// {deployment-address}{group-sequence-id}{order-sequence-id} -// -// -// AKA: DeploymentGroupID(daddr,gseq) + oseq -func OrderID(daddr []byte, gseq uint64, oseq uint64) []byte { - buf := new(bytes.Buffer) - buf.Write(daddr) - binary.Write(buf, binary.BigEndian, gseq) - binary.Write(buf, binary.BigEndian, oseq) - return buf.Bytes() -} - -// {deployment-address}{group-sequence-id}{order-sequence-id}{provider-address} -// -// -// AKA: OrderID(daddr,gseq,oseq) + provider-address -func FulfillmentID(daddr []byte, gseq uint64, oseq uint64, paddr []byte) []byte { - buf := new(bytes.Buffer) - buf.Write(daddr) - binary.Write(buf, binary.BigEndian, gseq) - binary.Write(buf, binary.BigEndian, oseq) - buf.Write(paddr) - return buf.Bytes() -} - -// {deployment-address}{group-sequence-id}{order-sequence-id}{provider-address} -// -// -// AKA: FulfillmentID(daddr,gseq,oseq) -func LeaseID(daddr []byte, gseq uint64, oseq uint64, paddr []byte) []byte { - return FulfillmentID(daddr, gseq, oseq, paddr) -} - -func IDForLease(obj *types.Lease) []byte { - return LeaseID(obj.Deployment, obj.Group, obj.Order, obj.Provider) -} - func DeploymentAddress(account []byte, nonce uint64) []byte { return NonceAddress(account, nonce) } diff --git a/state/lease.go b/state/lease.go index 5011659a49..b6eae83125 100644 --- a/state/lease.go +++ b/state/lease.go @@ -4,17 +4,15 @@ import ( "math" "github.com/gogo/protobuf/proto" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/types" "github.com/ovrclk/akash/types/base" ) type LeaseAdapter interface { Save(*types.Lease) error - Get(daddr base.Bytes, group uint64, order uint64, paddr base.Bytes) (*types.Lease, error) + Get(types.LeaseID) (*types.Lease, error) ForDeployment(deployment base.Bytes) ([]*types.Lease, error) - GetByKey(address base.Bytes) (*types.Lease, error) - IDFor(obj *types.Lease) []byte - KeyFor(id []byte) []byte All() ([]*types.Lease, error) } @@ -27,12 +25,12 @@ type leaseAdapter struct { } func (a *leaseAdapter) Save(obj *types.Lease) error { - path := a.KeyFor(a.IDFor(obj)) + path := a.keyFor(obj.LeaseID) return saveObject(a.db, path, obj) } -func (a *leaseAdapter) Get(daddr base.Bytes, group uint64, order uint64, paddr base.Bytes) (*types.Lease, error) { - path := a.KeyFor(LeaseID(daddr, group, order, paddr)) +func (a *leaseAdapter) Get(id types.LeaseID) (*types.Lease, error) { + path := a.keyFor(id) buf := a.db.Get(path) if buf == nil { return nil, nil @@ -41,19 +39,9 @@ func (a *leaseAdapter) Get(daddr base.Bytes, group uint64, order uint64, paddr b return obj, proto.Unmarshal(buf, obj) } -func (a *leaseAdapter) GetByKey(address base.Bytes) (*types.Lease, error) { - ful := types.Lease{} - key := a.KeyFor(address) - buf := a.db.Get(key) - if buf == nil { - return nil, nil - } - return &ful, ful.Unmarshal(buf) -} - -// /lease/{deployment-address}{group-sequence}{order-sequence}{provider-address} -func (a *leaseAdapter) KeyFor(id []byte) []byte { - return append([]byte(LeasePath), id...) +func (a *leaseAdapter) keyFor(id types.LeaseID) []byte { + key := keys.LeaseID(id).Bytes() + return append([]byte(LeasePath), key...) } func (a *leaseAdapter) All() ([]*types.Lease, error) { @@ -63,22 +51,36 @@ func (a *leaseAdapter) All() ([]*types.Lease, error) { } func (a *leaseAdapter) ForDeployment(deployment base.Bytes) ([]*types.Lease, error) { - min := a.KeyFor(LeaseID(deployment, 0, 0, MinAddress())) - max := a.KeyFor(LeaseID(deployment, math.MaxUint64, math.MaxUint64, MaxAddress())) - return a.forRange(min, max) -} -// {deployment-address}{group-sequence}{order-sequence}{provider-address} -func (a *leaseAdapter) IDFor(obj *types.Lease) []byte { - return LeaseID(obj.Deployment, obj.GetGroup(), obj.GetOrder(), obj.Provider) + min := a.keyFor(types.LeaseID{ + Deployment: deployment, + Provider: MinAddress(), + }) + + max := a.keyFor(types.LeaseID{ + Deployment: deployment, + Group: math.MaxUint64, + Order: math.MaxUint64, + Provider: MinAddress(), + }) + + return a.forRange(min, max) } func (a *leaseAdapter) allMinRange() []byte { - return a.KeyFor(LeaseID(MinAddress(), 0, 0, MinAddress())) + return a.keyFor(types.LeaseID{ + Deployment: MinAddress(), + Provider: MinAddress(), + }) } func (a *leaseAdapter) allMaxRange() []byte { - return a.KeyFor(LeaseID(MaxAddress(), math.MaxUint64, math.MaxUint64, MaxAddress())) + return a.keyFor(types.LeaseID{ + Deployment: MaxAddress(), + Group: math.MaxUint64, + Order: math.MaxUint64, + Provider: MaxAddress(), + }) } func (a *leaseAdapter) forRange(min, max []byte) ([]*types.Lease, error) { diff --git a/state/order.go b/state/order.go index 72146659e0..feb4d48869 100644 --- a/state/order.go +++ b/state/order.go @@ -3,18 +3,17 @@ package state import ( "math" + "github.com/ovrclk/akash/keys" "github.com/ovrclk/akash/types" "github.com/ovrclk/akash/types/base" ) type OrderAdapter interface { Save(*types.Order) error - GetByKey(base.Bytes) (*types.Order, error) - Get(addr base.Bytes, group uint64, order uint64) (*types.Order, error) + Get(types.OrderID) (*types.Order, error) ForDeployment(base.Bytes) ([]*types.Order, error) - ForGroup(*types.DeploymentGroup) ([]*types.Order, error) + ForGroup(types.DeploymentGroupID) ([]*types.Order, error) All() ([]*types.Order, error) - KeyFor(base.Bytes) base.Bytes } func NewOrderAdapter(db DB) OrderAdapter { @@ -26,17 +25,13 @@ type orderAdapter struct { } func (a *orderAdapter) Save(obj *types.Order) error { - path := a.KeyFor(a.IDFor(obj)) + path := a.keyFor(obj.OrderID) return saveObject(a.db, path, obj) } -func (d *orderAdapter) Get(addr base.Bytes, group uint64, order uint64) (*types.Order, error) { - return d.GetByKey(OrderID(addr, group, order)) -} - -func (d *orderAdapter) GetByKey(address base.Bytes) (*types.Order, error) { +func (d *orderAdapter) Get(id types.OrderID) (*types.Order, error) { + key := d.keyFor(id) depo := types.Order{} - key := d.KeyFor(address) buf := d.db.Get(key) if buf == nil { return nil, nil @@ -50,9 +45,9 @@ func (a *orderAdapter) ForDeployment(deployment base.Bytes) ([]*types.Order, err return a.forRange(min, max) } -func (a *orderAdapter) ForGroup(group *types.DeploymentGroup) ([]*types.Order, error) { - min := a.groupMinRange(group) - max := a.groupMaxRange(group) +func (a *orderAdapter) ForGroup(id types.DeploymentGroupID) ([]*types.Order, error) { + min := a.groupMinRange(id) + max := a.groupMaxRange(id) return a.forRange(min, max) } @@ -62,44 +57,52 @@ func (a *orderAdapter) All() ([]*types.Order, error) { return a.forRange(min, max) } -// /deployment-orders/{deployment-address}{group-sequence}{order-sequence} -func (a *orderAdapter) KeyFor(id base.Bytes) base.Bytes { - return append([]byte(OrderPath), id...) -} - -// {deployment-address}{group-sequence}{order-sequence}{provider-address} -func (a *orderAdapter) IDFor(obj *types.Order) []byte { - return OrderID(obj.Deployment, obj.GetGroup(), obj.GetSeq()) +func (a *orderAdapter) keyFor(id types.OrderID) base.Bytes { + path := keys.OrderID(id).Bytes() + return append([]byte(OrderPath), path...) } -// /deployment-orders/{deployment-address}{group-sequence}{order-sequence} func (a *orderAdapter) deploymentMinRange(deployment base.Bytes) []byte { - return a.KeyFor(OrderID(deployment, 0, 0)) + return a.keyFor(types.OrderID{ + Deployment: deployment, + }) } -// /deployment-orders/{deployment-address}{group-sequence}{max-order-sequence} func (a *orderAdapter) deploymentMaxRange(deployment base.Bytes) []byte { - return a.KeyFor(OrderID(deployment, math.MaxUint64, math.MaxUint64)) + return a.keyFor(types.OrderID{ + Deployment: deployment, + Group: math.MaxUint64, + Seq: math.MaxUint64, + }) } -// /deployment-orders/{deployment-address}{group-sequence}{order-sequence} -func (a *orderAdapter) groupMinRange(group *types.DeploymentGroup) []byte { - return a.KeyFor(OrderID(group.Deployment, group.GetSeq(), 0)) +func (a *orderAdapter) groupMinRange(id types.DeploymentGroupID) []byte { + return a.keyFor(types.OrderID{ + Deployment: id.Deployment, + Group: id.Seq, + }) } -// /deployment-orders/{deployment-address}{group-sequence}{max-order-sequence} -func (a *orderAdapter) groupMaxRange(group *types.DeploymentGroup) []byte { - return a.KeyFor(OrderID(group.Deployment, group.GetSeq(), math.MaxUint64)) +func (a *orderAdapter) groupMaxRange(id types.DeploymentGroupID) []byte { + return a.keyFor(types.OrderID{ + Deployment: id.Deployment, + Group: id.Seq, + Seq: math.MaxUint64, + }) } -// /deployment-orders/{min-address}{0}{0} func (a *orderAdapter) allMinRange() []byte { - return a.KeyFor(OrderID(MinAddress(), 0, 0)) + return a.keyFor(types.OrderID{ + Deployment: MinAddress(), + }) } -// /deployment-orders/{max-address}{max-group-sequence}{max-order-sequence} func (a *orderAdapter) allMaxRange() []byte { - return a.KeyFor(OrderID(MaxAddress(), math.MaxUint64, math.MaxUint64)) + return a.keyFor(types.OrderID{ + Deployment: MaxAddress(), + Group: math.MaxUint64, + Seq: math.MaxUint64, + }) } func (a *orderAdapter) forRange(min, max []byte) ([]*types.Order, error) { diff --git a/testutil/deployment.go b/testutil/deployment.go index 7a82faefb1..e2f169887c 100644 --- a/testutil/deployment.go +++ b/testutil/deployment.go @@ -93,7 +93,7 @@ func Deployment(tenant base.Bytes, nonce uint64) *types.Deployment { func DeploymentGroups(deployment base.Bytes, nonce uint64) *types.DeploymentGroups { orderTTL := int64(5) - nonce++ + // nonce++ runit := types.ResourceUnit{ Cpu: RandUint32(), @@ -113,8 +113,10 @@ func DeploymentGroups(deployment base.Bytes, nonce uint64) *types.DeploymentGrou } group := &types.DeploymentGroup{ - Deployment: deployment, - Seq: nonce, + DeploymentGroupID: types.DeploymentGroupID{ + Deployment: deployment, + Seq: nonce, + }, Resources: []types.ResourceGroup{rgroup}, Requirements: []types.ProviderAttribute{pattr}, OrderTTL: orderTTL, diff --git a/testutil/fulfillment.go b/testutil/fulfillment.go index efd97b7f17..d867eebb7b 100644 --- a/testutil/fulfillment.go +++ b/testutil/fulfillment.go @@ -5,7 +5,6 @@ import ( "testing" apptypes "github.com/ovrclk/akash/app/types" - "github.com/ovrclk/akash/state" "github.com/ovrclk/akash/types" "github.com/ovrclk/akash/types/base" "github.com/stretchr/testify/assert" @@ -17,11 +16,8 @@ func CreateFulfillment(t *testing.T, app apptypes.Application, provider base.Byt fulfillmenttx := &types.TxPayload_TxCreateFulfillment{ TxCreateFulfillment: &types.TxCreateFulfillment{ - Deployment: fulfillment.Deployment, - Group: fulfillment.Group, - Order: fulfillment.Order, - Provider: fulfillment.Provider, - Price: fulfillment.Price, + FulfillmentID: fulfillment.FulfillmentID, + Price: fulfillment.Price, }, } @@ -41,12 +37,11 @@ func CreateFulfillment(t *testing.T, app apptypes.Application, provider base.Byt return fulfillment } -func CloseFulfillment(t *testing.T, app apptypes.Application, key crypto.PrivKey, fulfillment *types.Fulfillment) base.Bytes { - faddr := state.FulfillmentID(fulfillment.Deployment, fulfillment.Group, fulfillment.Order, fulfillment.Provider) +func CloseFulfillment(t *testing.T, app apptypes.Application, key crypto.PrivKey, fulfillment *types.Fulfillment) { tx := &types.TxPayload_TxCloseFulfillment{ TxCloseFulfillment: &types.TxCloseFulfillment{ - Fulfillment: faddr, + FulfillmentID: fulfillment.FulfillmentID, }, } @@ -63,16 +58,17 @@ func CloseFulfillment(t *testing.T, app apptypes.Application, key crypto.PrivKey dresp := app.DeliverTx(ctx, tx) assert.Len(t, dresp.Log, 0, fmt.Sprint("Log should be empty but is: ", dresp.Log)) assert.True(t, dresp.IsOK()) - return faddr } func Fulfillment(provider base.Bytes, deplyment base.Bytes, group, order uint64, price uint32) *types.Fulfillment { fulfillment := &types.Fulfillment{ - Deployment: deplyment, - Group: group, - Order: order, - Provider: provider, - Price: price, + FulfillmentID: types.FulfillmentID{ + Deployment: deplyment, + Group: group, + Order: order, + Provider: provider, + }, + Price: price, } return fulfillment } diff --git a/testutil/lease.go b/testutil/lease.go index 74a5de1168..7fd3d43639 100644 --- a/testutil/lease.go +++ b/testutil/lease.go @@ -16,11 +16,8 @@ func CreateLease(t *testing.T, app apptypes.Application, provider base.Bytes, ke tx := &types.TxPayload_TxCreateLease{ TxCreateLease: &types.TxCreateLease{ - Deployment: lease.Deployment, - Group: lease.Group, - Order: lease.Order, - Provider: lease.Provider, - Price: lease.Price, + LeaseID: lease.LeaseID, + Price: lease.Price, }, } @@ -40,10 +37,10 @@ func CreateLease(t *testing.T, app apptypes.Application, provider base.Bytes, ke return lease } -func CloseLease(t *testing.T, app apptypes.Application, lease base.Bytes, key crypto.PrivKey) { +func CloseLease(t *testing.T, app apptypes.Application, id types.LeaseID, key crypto.PrivKey) { tx := &types.TxPayload_TxCloseLease{ TxCloseLease: &types.TxCloseLease{ - Lease: lease, + LeaseID: id, }, } @@ -64,11 +61,13 @@ func CloseLease(t *testing.T, app apptypes.Application, lease base.Bytes, key cr func Lease(provider base.Bytes, deplyment base.Bytes, group, order uint64, price uint32) *types.Lease { lease := &types.Lease{ - Deployment: deplyment, - Group: group, - Order: order, - Provider: provider, - Price: price, + LeaseID: types.LeaseID{ + Deployment: deplyment, + Group: group, + Order: order, + Provider: provider, + }, + Price: price, } return lease } diff --git a/testutil/order.go b/testutil/order.go index d2ad8f87e4..e76edd2345 100644 --- a/testutil/order.go +++ b/testutil/order.go @@ -16,10 +16,8 @@ func CreateOrder(t *testing.T, app apptypes.Application, account *types.Account, tx := &types.TxPayload_TxCreateOrder{ TxCreateOrder: &types.TxCreateOrder{ - Deployment: order.Deployment, - Group: order.Group, - Seq: order.Seq, - EndAt: order.EndAt, + OrderID: order.OrderID, + EndAt: order.EndAt, }, } @@ -33,6 +31,7 @@ func CreateOrder(t *testing.T, app apptypes.Application, account *types.Account, assert.True(t, app.AcceptTx(ctx, tx)) cresp := app.CheckTx(ctx, tx) assert.True(t, cresp.IsOK()) + assert.Empty(t, cresp.Log) dresp := app.DeliverTx(ctx, tx) assert.Len(t, dresp.Log, 0, fmt.Sprint("Log should be empty but is: ", dresp.Log)) assert.True(t, dresp.IsOK()) @@ -41,10 +40,12 @@ func CreateOrder(t *testing.T, app apptypes.Application, account *types.Account, func Order(deploymentAddress base.Bytes, groupSeq, orderSeq uint64) *types.Order { order := &types.Order{ - Deployment: deploymentAddress, - Group: groupSeq, - Seq: orderSeq, - EndAt: int64(0), + OrderID: types.OrderID{ + Deployment: deploymentAddress, + Group: groupSeq, + Seq: orderSeq, + }, + EndAt: int64(0), } return order } diff --git a/types/base/bytes.go b/types/base/bytes.go index 18763ab746..07a75166fb 100644 --- a/types/base/bytes.go +++ b/types/base/bytes.go @@ -41,10 +41,12 @@ func (t Bytes) EncodeString() string { return util.X(t) } +func (t Bytes) String() string { + return t.EncodeString() +} + func (this Bytes) Compare(that Bytes) int { - thisb, _ := this.Marshal() - thatb, _ := that.Marshal() - return bytes.Compare(thisb, thatb) + return bytes.Compare([]byte(this), []byte(that)) } func DecodeString(buf string) (Bytes, error) { diff --git a/types/id.go b/types/id.go new file mode 100644 index 0000000000..affe6ab0c5 --- /dev/null +++ b/types/id.go @@ -0,0 +1,70 @@ +package types + +import ( + "github.com/ovrclk/akash/types/base" +) + +func (id DeploymentGroupID) DeploymentID() base.Bytes { + return id.Deployment +} + +func (id OrderID) GroupID() DeploymentGroupID { + return DeploymentGroupID{ + Deployment: id.Deployment, + Seq: id.Group, + } +} + +func (id OrderID) DeploymentID() base.Bytes { + return id.Deployment +} + +func (id FulfillmentID) LeaseID() LeaseID { + return LeaseID{ + Deployment: id.Deployment, + Group: id.Group, + Order: id.Order, + Provider: id.Provider, + } +} + +func (id FulfillmentID) OrderID() OrderID { + return OrderID{ + Deployment: id.Deployment, + Group: id.Group, + Seq: id.Order, + } +} + +func (id FulfillmentID) GroupID() DeploymentGroupID { + return id.OrderID().GroupID() +} + +func (id FulfillmentID) DeploymentID() base.Bytes { + return id.Deployment +} + +func (id LeaseID) FulfillmentID() FulfillmentID { + return FulfillmentID{ + Deployment: id.Deployment, + Group: id.Group, + Order: id.Order, + Provider: id.Provider, + } +} + +func (id LeaseID) OrderID() OrderID { + return OrderID{ + Deployment: id.Deployment, + Group: id.Group, + Seq: id.Order, + } +} + +func (id LeaseID) GroupID() DeploymentGroupID { + return id.OrderID().GroupID() +} + +func (id LeaseID) DeploymentID() base.Bytes { + return id.Deployment +} diff --git a/types/types.pb.go b/types/types.pb.go index 5e5817035a..9f7f62d414 100644 --- a/types/types.pb.go +++ b/types/types.pb.go @@ -20,18 +20,22 @@ ResourceGroup ProviderAttribute GroupSpec + DeploymentGroupID DeploymentGroup DeploymentGroups Deployment Deployments TxCreateDeployment TxCloseDeployment + OrderID Order TxCreateOrder Orders + FulfillmentID Fulfillment TxCreateFulfillment TxCloseFulfillment + LeaseID Lease TxCreateLease TxCloseLease @@ -90,7 +94,7 @@ func (x DeploymentGroup_DeploymentGroupState) String() string { return proto.EnumName(DeploymentGroup_DeploymentGroupState_name, int32(x)) } func (DeploymentGroup_DeploymentGroupState) EnumDescriptor() ([]byte, []int) { - return fileDescriptorTypes, []int{12, 0} + return fileDescriptorTypes, []int{13, 0} } type Deployment_DeploymentState int32 @@ -113,7 +117,7 @@ func (x Deployment_DeploymentState) String() string { return proto.EnumName(Deployment_DeploymentState_name, int32(x)) } func (Deployment_DeploymentState) EnumDescriptor() ([]byte, []int) { - return fileDescriptorTypes, []int{14, 0} + return fileDescriptorTypes, []int{15, 0} } type TxCloseDeployment_ReasonCode int32 @@ -139,7 +143,7 @@ func (x TxCloseDeployment_ReasonCode) String() string { return proto.EnumName(TxCloseDeployment_ReasonCode_name, int32(x)) } func (TxCloseDeployment_ReasonCode) EnumDescriptor() ([]byte, []int) { - return fileDescriptorTypes, []int{17, 0} + return fileDescriptorTypes, []int{18, 0} } type Order_OrderState int32 @@ -164,7 +168,7 @@ var Order_OrderState_value = map[string]int32{ func (x Order_OrderState) String() string { return proto.EnumName(Order_OrderState_name, int32(x)) } -func (Order_OrderState) EnumDescriptor() ([]byte, []int) { return fileDescriptorTypes, []int{18, 0} } +func (Order_OrderState) EnumDescriptor() ([]byte, []int) { return fileDescriptorTypes, []int{20, 0} } type Fulfillment_FulfillmentState int32 @@ -189,7 +193,7 @@ func (x Fulfillment_FulfillmentState) String() string { return proto.EnumName(Fulfillment_FulfillmentState_name, int32(x)) } func (Fulfillment_FulfillmentState) EnumDescriptor() ([]byte, []int) { - return fileDescriptorTypes, []int{21, 0} + return fileDescriptorTypes, []int{24, 0} } type Lease_LeaseState int32 @@ -211,7 +215,7 @@ var Lease_LeaseState_value = map[string]int32{ func (x Lease_LeaseState) String() string { return proto.EnumName(Lease_LeaseState_name, int32(x)) } -func (Lease_LeaseState) EnumDescriptor() ([]byte, []int) { return fileDescriptorTypes, []int{24, 0} } +func (Lease_LeaseState) EnumDescriptor() ([]byte, []int) { return fileDescriptorTypes, []int{28, 0} } // BEGIN GLOBAL type Genesis struct { @@ -840,11 +844,27 @@ func (m *GroupSpec) GetResources() []ResourceGroup { return nil } -type DeploymentGroup struct { +type DeploymentGroupID struct { // deployment address Deployment github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=deployment,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"deployment"` // unique sequence over deployment Seq uint64 `protobuf:"varint,2,opt,name=seq,proto3" json:"seq,omitempty"` +} + +func (m *DeploymentGroupID) Reset() { *m = DeploymentGroupID{} } +func (m *DeploymentGroupID) String() string { return proto.CompactTextString(m) } +func (*DeploymentGroupID) ProtoMessage() {} +func (*DeploymentGroupID) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{12} } + +func (m *DeploymentGroupID) GetSeq() uint64 { + if m != nil { + return m.Seq + } + return 0 +} + +type DeploymentGroup struct { + DeploymentGroupID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` // max number of blocks orders are open OrderTTL int64 `protobuf:"varint,3,opt,name=orderTTL,proto3" json:"orderTTL,omitempty"` State DeploymentGroup_DeploymentGroupState `protobuf:"varint,4,opt,name=state,proto3,enum=types.DeploymentGroup_DeploymentGroupState" json:"state,omitempty"` @@ -855,14 +875,7 @@ type DeploymentGroup struct { func (m *DeploymentGroup) Reset() { *m = DeploymentGroup{} } func (m *DeploymentGroup) String() string { return proto.CompactTextString(m) } func (*DeploymentGroup) ProtoMessage() {} -func (*DeploymentGroup) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{12} } - -func (m *DeploymentGroup) GetSeq() uint64 { - if m != nil { - return m.Seq - } - return 0 -} +func (*DeploymentGroup) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{13} } func (m *DeploymentGroup) GetOrderTTL() int64 { if m != nil { @@ -899,7 +912,7 @@ type DeploymentGroups struct { func (m *DeploymentGroups) Reset() { *m = DeploymentGroups{} } func (m *DeploymentGroups) String() string { return proto.CompactTextString(m) } func (*DeploymentGroups) ProtoMessage() {} -func (*DeploymentGroups) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{13} } +func (*DeploymentGroups) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{14} } func (m *DeploymentGroups) GetItems() []*DeploymentGroup { if m != nil { @@ -918,7 +931,7 @@ type Deployment struct { func (m *Deployment) Reset() { *m = Deployment{} } func (m *Deployment) String() string { return proto.CompactTextString(m) } func (*Deployment) ProtoMessage() {} -func (*Deployment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{14} } +func (*Deployment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{15} } func (m *Deployment) GetState() Deployment_DeploymentState { if m != nil { @@ -934,7 +947,7 @@ type Deployments struct { func (m *Deployments) Reset() { *m = Deployments{} } func (m *Deployments) String() string { return proto.CompactTextString(m) } func (*Deployments) ProtoMessage() {} -func (*Deployments) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{15} } +func (*Deployments) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{16} } func (m *Deployments) GetItems() []Deployment { if m != nil { @@ -953,7 +966,7 @@ type TxCreateDeployment struct { func (m *TxCreateDeployment) Reset() { *m = TxCreateDeployment{} } func (m *TxCreateDeployment) String() string { return proto.CompactTextString(m) } func (*TxCreateDeployment) ProtoMessage() {} -func (*TxCreateDeployment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{16} } +func (*TxCreateDeployment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{17} } func (m *TxCreateDeployment) GetNonce() uint64 { if m != nil { @@ -985,7 +998,7 @@ type TxCloseDeployment struct { func (m *TxCloseDeployment) Reset() { *m = TxCloseDeployment{} } func (m *TxCloseDeployment) String() string { return proto.CompactTextString(m) } func (*TxCloseDeployment) ProtoMessage() {} -func (*TxCloseDeployment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{17} } +func (*TxCloseDeployment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{18} } func (m *TxCloseDeployment) GetReason() TxCloseDeployment_ReasonCode { if m != nil { @@ -994,37 +1007,46 @@ func (m *TxCloseDeployment) GetReason() TxCloseDeployment_ReasonCode { return TxCloseDeployment_UNSET } -type Order struct { - // deployment address +type OrderID struct { + // deployment Deployment github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=deployment,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"deployment"` // deployment group sequence Group uint64 `protobuf:"varint,2,opt,name=group,proto3" json:"group,omitempty"` // order sequence Seq uint64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` - // maximum block number order can be open - EndAt int64 `protobuf:"varint,4,opt,name=endAt,proto3" json:"endAt,omitempty"` - State Order_OrderState `protobuf:"varint,5,opt,name=state,proto3,enum=types.Order_OrderState" json:"state,omitempty"` } -func (m *Order) Reset() { *m = Order{} } -func (m *Order) String() string { return proto.CompactTextString(m) } -func (*Order) ProtoMessage() {} -func (*Order) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{18} } +func (m *OrderID) Reset() { *m = OrderID{} } +func (m *OrderID) String() string { return proto.CompactTextString(m) } +func (*OrderID) ProtoMessage() {} +func (*OrderID) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{19} } -func (m *Order) GetGroup() uint64 { +func (m *OrderID) GetGroup() uint64 { if m != nil { return m.Group } return 0 } -func (m *Order) GetSeq() uint64 { +func (m *OrderID) GetSeq() uint64 { if m != nil { return m.Seq } return 0 } +type Order struct { + OrderID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` + // maximum block number order can be open + EndAt int64 `protobuf:"varint,2,opt,name=endAt,proto3" json:"endAt,omitempty"` + State Order_OrderState `protobuf:"varint,3,opt,name=state,proto3,enum=types.Order_OrderState" json:"state,omitempty"` +} + +func (m *Order) Reset() { *m = Order{} } +func (m *Order) String() string { return proto.CompactTextString(m) } +func (*Order) ProtoMessage() {} +func (*Order) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{20} } + func (m *Order) GetEndAt() int64 { if m != nil { return m.EndAt @@ -1040,34 +1062,15 @@ func (m *Order) GetState() Order_OrderState { } type TxCreateOrder struct { - // deployment address - Deployment github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=deployment,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"deployment"` - // deployment group sequence - Group uint64 `protobuf:"varint,2,opt,name=group,proto3" json:"group,omitempty"` - // order sequence - Seq uint64 `protobuf:"varint,3,opt,name=seq,proto3" json:"seq,omitempty"` + OrderID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` // maximum block number order can be open - EndAt int64 `protobuf:"varint,4,opt,name=endAt,proto3" json:"endAt,omitempty"` + EndAt int64 `protobuf:"varint,2,opt,name=endAt,proto3" json:"endAt,omitempty"` } func (m *TxCreateOrder) Reset() { *m = TxCreateOrder{} } func (m *TxCreateOrder) String() string { return proto.CompactTextString(m) } func (*TxCreateOrder) ProtoMessage() {} -func (*TxCreateOrder) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{19} } - -func (m *TxCreateOrder) GetGroup() uint64 { - if m != nil { - return m.Group - } - return 0 -} - -func (m *TxCreateOrder) GetSeq() uint64 { - if m != nil { - return m.Seq - } - return 0 -} +func (*TxCreateOrder) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{21} } func (m *TxCreateOrder) GetEndAt() int64 { if m != nil { @@ -1083,7 +1086,7 @@ type Orders struct { func (m *Orders) Reset() { *m = Orders{} } func (m *Orders) String() string { return proto.CompactTextString(m) } func (*Orders) ProtoMessage() {} -func (*Orders) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{20} } +func (*Orders) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{22} } func (m *Orders) GetItems() []*Order { if m != nil { @@ -1092,7 +1095,7 @@ func (m *Orders) GetItems() []*Order { return nil } -type Fulfillment struct { +type FulfillmentID struct { // deployment address Deployment github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=deployment,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"deployment"` // deployment group sequence @@ -1101,29 +1104,38 @@ type Fulfillment struct { Order uint64 `protobuf:"varint,3,opt,name=order,proto3" json:"order,omitempty"` // provider address Provider github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,4,opt,name=provider,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"provider"` - Price uint32 `protobuf:"varint,5,opt,name=price,proto3" json:"price,omitempty"` - State Fulfillment_FulfillmentState `protobuf:"varint,6,opt,name=state,proto3,enum=types.Fulfillment_FulfillmentState" json:"state,omitempty"` } -func (m *Fulfillment) Reset() { *m = Fulfillment{} } -func (m *Fulfillment) String() string { return proto.CompactTextString(m) } -func (*Fulfillment) ProtoMessage() {} -func (*Fulfillment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{21} } +func (m *FulfillmentID) Reset() { *m = FulfillmentID{} } +func (m *FulfillmentID) String() string { return proto.CompactTextString(m) } +func (*FulfillmentID) ProtoMessage() {} +func (*FulfillmentID) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{23} } -func (m *Fulfillment) GetGroup() uint64 { +func (m *FulfillmentID) GetGroup() uint64 { if m != nil { return m.Group } return 0 } -func (m *Fulfillment) GetOrder() uint64 { +func (m *FulfillmentID) GetOrder() uint64 { if m != nil { return m.Order } return 0 } +type Fulfillment struct { + FulfillmentID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` + Price uint32 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` + State Fulfillment_FulfillmentState `protobuf:"varint,3,opt,name=state,proto3,enum=types.Fulfillment_FulfillmentState" json:"state,omitempty"` +} + +func (m *Fulfillment) Reset() { *m = Fulfillment{} } +func (m *Fulfillment) String() string { return proto.CompactTextString(m) } +func (*Fulfillment) ProtoMessage() {} +func (*Fulfillment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{24} } + func (m *Fulfillment) GetPrice() uint32 { if m != nil { return m.Price @@ -1139,35 +1151,14 @@ func (m *Fulfillment) GetState() Fulfillment_FulfillmentState { } type TxCreateFulfillment struct { - // deployment address - Deployment github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=deployment,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"deployment"` - // deployment group sequence - Group uint64 `protobuf:"varint,2,opt,name=group,proto3" json:"group,omitempty"` - // order sequence - Order uint64 `protobuf:"varint,3,opt,name=order,proto3" json:"order,omitempty"` - // provider address - Provider github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,4,opt,name=provider,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"provider"` - Price uint32 `protobuf:"varint,5,opt,name=price,proto3" json:"price,omitempty"` + FulfillmentID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` + Price uint32 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` } func (m *TxCreateFulfillment) Reset() { *m = TxCreateFulfillment{} } func (m *TxCreateFulfillment) String() string { return proto.CompactTextString(m) } func (*TxCreateFulfillment) ProtoMessage() {} -func (*TxCreateFulfillment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{22} } - -func (m *TxCreateFulfillment) GetGroup() uint64 { - if m != nil { - return m.Group - } - return 0 -} - -func (m *TxCreateFulfillment) GetOrder() uint64 { - if m != nil { - return m.Order - } - return 0 -} +func (*TxCreateFulfillment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{25} } func (m *TxCreateFulfillment) GetPrice() uint32 { if m != nil { @@ -1177,16 +1168,15 @@ func (m *TxCreateFulfillment) GetPrice() uint32 { } type TxCloseFulfillment struct { - // fulfillment address - Fulfillment github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=fulfillment,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"fulfillment"` + FulfillmentID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` } func (m *TxCloseFulfillment) Reset() { *m = TxCloseFulfillment{} } func (m *TxCloseFulfillment) String() string { return proto.CompactTextString(m) } func (*TxCloseFulfillment) ProtoMessage() {} -func (*TxCloseFulfillment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{23} } +func (*TxCloseFulfillment) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{26} } -type Lease struct { +type LeaseID struct { // deployment address Deployment github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=deployment,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"deployment"` // deployment group sequence @@ -1195,30 +1185,39 @@ type Lease struct { Order uint64 `protobuf:"varint,3,opt,name=order,proto3" json:"order,omitempty"` // provider address Provider github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,4,opt,name=provider,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"provider"` - // price of matching fulfillment - Price uint32 `protobuf:"varint,5,opt,name=price,proto3" json:"price,omitempty"` - State Lease_LeaseState `protobuf:"varint,6,opt,name=state,proto3,enum=types.Lease_LeaseState" json:"state,omitempty"` } -func (m *Lease) Reset() { *m = Lease{} } -func (m *Lease) String() string { return proto.CompactTextString(m) } -func (*Lease) ProtoMessage() {} -func (*Lease) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{24} } +func (m *LeaseID) Reset() { *m = LeaseID{} } +func (m *LeaseID) String() string { return proto.CompactTextString(m) } +func (*LeaseID) ProtoMessage() {} +func (*LeaseID) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{27} } -func (m *Lease) GetGroup() uint64 { +func (m *LeaseID) GetGroup() uint64 { if m != nil { return m.Group } return 0 } -func (m *Lease) GetOrder() uint64 { +func (m *LeaseID) GetOrder() uint64 { if m != nil { return m.Order } return 0 } +type Lease struct { + LeaseID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` + // price of matching fulfillment + Price uint32 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` + State Lease_LeaseState `protobuf:"varint,3,opt,name=state,proto3,enum=types.Lease_LeaseState" json:"state,omitempty"` +} + +func (m *Lease) Reset() { *m = Lease{} } +func (m *Lease) String() string { return proto.CompactTextString(m) } +func (*Lease) ProtoMessage() {} +func (*Lease) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{28} } + func (m *Lease) GetPrice() uint32 { if m != nil { return m.Price @@ -1234,36 +1233,15 @@ func (m *Lease) GetState() Lease_LeaseState { } type TxCreateLease struct { - // deployment address - Deployment github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=deployment,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"deployment"` - // deployment group sequence - Group uint64 `protobuf:"varint,2,opt,name=group,proto3" json:"group,omitempty"` - // order sequence - Order uint64 `protobuf:"varint,3,opt,name=order,proto3" json:"order,omitempty"` - // provider address - Provider github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,4,opt,name=provider,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"provider"` + LeaseID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` // price of matching fulfillment - Price uint32 `protobuf:"varint,5,opt,name=price,proto3" json:"price,omitempty"` + Price uint32 `protobuf:"varint,2,opt,name=price,proto3" json:"price,omitempty"` } func (m *TxCreateLease) Reset() { *m = TxCreateLease{} } func (m *TxCreateLease) String() string { return proto.CompactTextString(m) } func (*TxCreateLease) ProtoMessage() {} -func (*TxCreateLease) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{25} } - -func (m *TxCreateLease) GetGroup() uint64 { - if m != nil { - return m.Group - } - return 0 -} - -func (m *TxCreateLease) GetOrder() uint64 { - if m != nil { - return m.Order - } - return 0 -} +func (*TxCreateLease) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{29} } func (m *TxCreateLease) GetPrice() uint32 { if m != nil { @@ -1273,13 +1251,13 @@ func (m *TxCreateLease) GetPrice() uint32 { } type TxCloseLease struct { - Lease github_com_ovrclk_akash_types_base.Bytes `protobuf:"bytes,1,opt,name=lease,proto3,customtype=github.com/ovrclk/akash/types/base.Bytes" json:"lease"` + LeaseID `protobuf:"bytes,1,opt,name=id,embedded=id" json:"id"` } func (m *TxCloseLease) Reset() { *m = TxCloseLease{} } func (m *TxCloseLease) String() string { return proto.CompactTextString(m) } func (*TxCloseLease) ProtoMessage() {} -func (*TxCloseLease) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{26} } +func (*TxCloseLease) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{30} } type Leases struct { Items []*Lease `protobuf:"bytes,1,rep,name=items" json:"items,omitempty"` @@ -1288,7 +1266,7 @@ type Leases struct { func (m *Leases) Reset() { *m = Leases{} } func (m *Leases) String() string { return proto.CompactTextString(m) } func (*Leases) ProtoMessage() {} -func (*Leases) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{27} } +func (*Leases) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{31} } func (m *Leases) GetItems() []*Lease { if m != nil { @@ -1307,7 +1285,7 @@ type ManifestRequest struct { func (m *ManifestRequest) Reset() { *m = ManifestRequest{} } func (m *ManifestRequest) String() string { return proto.CompactTextString(m) } func (*ManifestRequest) ProtoMessage() {} -func (*ManifestRequest) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{28} } +func (*ManifestRequest) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{32} } func (m *ManifestRequest) GetManifest() *Manifest { if m != nil { @@ -1323,7 +1301,7 @@ type Manifest struct { func (m *Manifest) Reset() { *m = Manifest{} } func (m *Manifest) String() string { return proto.CompactTextString(m) } func (*Manifest) ProtoMessage() {} -func (*Manifest) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{29} } +func (*Manifest) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{33} } func (m *Manifest) GetGroups() []*ManifestGroup { if m != nil { @@ -1342,7 +1320,7 @@ type ManifestGroup struct { func (m *ManifestGroup) Reset() { *m = ManifestGroup{} } func (m *ManifestGroup) String() string { return proto.CompactTextString(m) } func (*ManifestGroup) ProtoMessage() {} -func (*ManifestGroup) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{30} } +func (*ManifestGroup) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{34} } func (m *ManifestGroup) GetName() string { if m != nil { @@ -1374,7 +1352,7 @@ type ManifestService struct { func (m *ManifestService) Reset() { *m = ManifestService{} } func (m *ManifestService) String() string { return proto.CompactTextString(m) } func (*ManifestService) ProtoMessage() {} -func (*ManifestService) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{31} } +func (*ManifestService) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{35} } func (m *ManifestService) GetName() string { if m != nil { @@ -1421,7 +1399,7 @@ type ManifestServiceExpose struct { func (m *ManifestServiceExpose) Reset() { *m = ManifestServiceExpose{} } func (m *ManifestServiceExpose) String() string { return proto.CompactTextString(m) } func (*ManifestServiceExpose) ProtoMessage() {} -func (*ManifestServiceExpose) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{32} } +func (*ManifestServiceExpose) Descriptor() ([]byte, []int) { return fileDescriptorTypes, []int{36} } func (m *ManifestServiceExpose) GetPort() uint32 { if m != nil { @@ -1464,18 +1442,22 @@ func init() { proto.RegisterType((*ResourceGroup)(nil), "types.ResourceGroup") proto.RegisterType((*ProviderAttribute)(nil), "types.ProviderAttribute") proto.RegisterType((*GroupSpec)(nil), "types.GroupSpec") + proto.RegisterType((*DeploymentGroupID)(nil), "types.DeploymentGroupID") proto.RegisterType((*DeploymentGroup)(nil), "types.DeploymentGroup") proto.RegisterType((*DeploymentGroups)(nil), "types.DeploymentGroups") proto.RegisterType((*Deployment)(nil), "types.Deployment") proto.RegisterType((*Deployments)(nil), "types.Deployments") proto.RegisterType((*TxCreateDeployment)(nil), "types.TxCreateDeployment") proto.RegisterType((*TxCloseDeployment)(nil), "types.TxCloseDeployment") + proto.RegisterType((*OrderID)(nil), "types.OrderID") proto.RegisterType((*Order)(nil), "types.Order") proto.RegisterType((*TxCreateOrder)(nil), "types.TxCreateOrder") proto.RegisterType((*Orders)(nil), "types.Orders") + proto.RegisterType((*FulfillmentID)(nil), "types.FulfillmentID") proto.RegisterType((*Fulfillment)(nil), "types.Fulfillment") proto.RegisterType((*TxCreateFulfillment)(nil), "types.TxCreateFulfillment") proto.RegisterType((*TxCloseFulfillment)(nil), "types.TxCloseFulfillment") + proto.RegisterType((*LeaseID)(nil), "types.LeaseID") proto.RegisterType((*Lease)(nil), "types.Lease") proto.RegisterType((*TxCreateLease)(nil), "types.TxCreateLease") proto.RegisterType((*TxCloseLease)(nil), "types.TxCloseLease") @@ -1710,7 +1692,7 @@ func (this *ProviderAttribute) Compare(that interface{}) int { } return 0 } -func (this *DeploymentGroup) Compare(that interface{}) int { +func (this *DeploymentGroupID) Compare(that interface{}) int { if that == nil { if this == nil { return 0 @@ -1718,9 +1700,9 @@ func (this *DeploymentGroup) Compare(that interface{}) int { return 1 } - that1, ok := that.(*DeploymentGroup) + that1, ok := that.(*DeploymentGroupID) if !ok { - that2, ok := that.(DeploymentGroup) + that2, ok := that.(DeploymentGroupID) if ok { that1 = &that2 } else { @@ -1744,6 +1726,36 @@ func (this *DeploymentGroup) Compare(that interface{}) int { } return 1 } + return 0 +} +func (this *DeploymentGroup) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*DeploymentGroup) + if !ok { + that2, ok := that.(DeploymentGroup) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if c := this.DeploymentGroupID.Compare(&that1.DeploymentGroupID); c != 0 { + return c + } if this.OrderTTL != that1.OrderTTL { if this.OrderTTL < that1.OrderTTL { return -1 @@ -1819,7 +1831,7 @@ func (this *Deployment) Compare(that interface{}) int { } return 0 } -func (this *Order) Compare(that interface{}) int { +func (this *OrderID) Compare(that interface{}) int { if that == nil { if this == nil { return 0 @@ -1827,9 +1839,9 @@ func (this *Order) Compare(that interface{}) int { return 1 } - that1, ok := that.(*Order) + that1, ok := that.(*OrderID) if !ok { - that2, ok := that.(Order) + that2, ok := that.(OrderID) if ok { that1 = &that2 } else { @@ -1859,6 +1871,36 @@ func (this *Order) Compare(that interface{}) int { } return 1 } + return 0 +} +func (this *Order) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Order) + if !ok { + that2, ok := that.(Order) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if c := this.OrderID.Compare(&that1.OrderID); c != 0 { + return c + } if this.EndAt != that1.EndAt { if this.EndAt < that1.EndAt { return -1 @@ -1873,7 +1915,7 @@ func (this *Order) Compare(that interface{}) int { } return 0 } -func (this *Fulfillment) Compare(that interface{}) int { +func (this *FulfillmentID) Compare(that interface{}) int { if that == nil { if this == nil { return 0 @@ -1881,9 +1923,9 @@ func (this *Fulfillment) Compare(that interface{}) int { return 1 } - that1, ok := that.(*Fulfillment) + that1, ok := that.(*FulfillmentID) if !ok { - that2, ok := that.(Fulfillment) + that2, ok := that.(FulfillmentID) if ok { that1 = &that2 } else { @@ -1916,6 +1958,36 @@ func (this *Fulfillment) Compare(that interface{}) int { if c := this.Provider.Compare(that1.Provider); c != 0 { return c } + return 0 +} +func (this *Fulfillment) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*Fulfillment) + if !ok { + that2, ok := that.(Fulfillment) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if c := this.FulfillmentID.Compare(&that1.FulfillmentID); c != 0 { + return c + } if this.Price != that1.Price { if this.Price < that1.Price { return -1 @@ -1930,6 +2002,51 @@ func (this *Fulfillment) Compare(that interface{}) int { } return 0 } +func (this *LeaseID) Compare(that interface{}) int { + if that == nil { + if this == nil { + return 0 + } + return 1 + } + + that1, ok := that.(*LeaseID) + if !ok { + that2, ok := that.(LeaseID) + if ok { + that1 = &that2 + } else { + return 1 + } + } + if that1 == nil { + if this == nil { + return 0 + } + return 1 + } else if this == nil { + return -1 + } + if c := this.Deployment.Compare(that1.Deployment); c != 0 { + return c + } + if this.Group != that1.Group { + if this.Group < that1.Group { + return -1 + } + return 1 + } + if this.Order != that1.Order { + if this.Order < that1.Order { + return -1 + } + return 1 + } + if c := this.Provider.Compare(that1.Provider); c != 0 { + return c + } + return 0 +} func (this *Genesis) GoString() string { if this == nil { return "nil" @@ -2179,16 +2296,26 @@ func (this *GroupSpec) GoString() string { s = append(s, "}") return strings.Join(s, "") } -func (this *DeploymentGroup) GoString() string { +func (this *DeploymentGroupID) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 10) - s = append(s, "&types.DeploymentGroup{") + s := make([]string, 0, 6) + s = append(s, "&types.DeploymentGroupID{") s = append(s, "Deployment: "+fmt.Sprintf("%#v", this.Deployment)+",\n") s = append(s, "Seq: "+fmt.Sprintf("%#v", this.Seq)+",\n") - s = append(s, "OrderTTL: "+fmt.Sprintf("%#v", this.OrderTTL)+",\n") - s = append(s, "State: "+fmt.Sprintf("%#v", this.State)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *DeploymentGroup) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 9) + s = append(s, "&types.DeploymentGroup{") + s = append(s, "DeploymentGroupID: "+strings.Replace(this.DeploymentGroupID.GoString(), `&`, ``, 1)+",\n") + s = append(s, "OrderTTL: "+fmt.Sprintf("%#v", this.OrderTTL)+",\n") + s = append(s, "State: "+fmt.Sprintf("%#v", this.State)+",\n") if this.Requirements != nil { vs := make([]*ProviderAttribute, len(this.Requirements)) for i := range vs { @@ -2272,15 +2399,25 @@ func (this *TxCloseDeployment) GoString() string { s = append(s, "}") return strings.Join(s, "") } -func (this *Order) GoString() string { +func (this *OrderID) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 9) - s = append(s, "&types.Order{") + s := make([]string, 0, 7) + s = append(s, "&types.OrderID{") s = append(s, "Deployment: "+fmt.Sprintf("%#v", this.Deployment)+",\n") s = append(s, "Group: "+fmt.Sprintf("%#v", this.Group)+",\n") s = append(s, "Seq: "+fmt.Sprintf("%#v", this.Seq)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Order) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&types.Order{") + s = append(s, "OrderID: "+strings.Replace(this.OrderID.GoString(), `&`, ``, 1)+",\n") s = append(s, "EndAt: "+fmt.Sprintf("%#v", this.EndAt)+",\n") s = append(s, "State: "+fmt.Sprintf("%#v", this.State)+",\n") s = append(s, "}") @@ -2290,11 +2427,9 @@ func (this *TxCreateOrder) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 8) + s := make([]string, 0, 6) s = append(s, "&types.TxCreateOrder{") - s = append(s, "Deployment: "+fmt.Sprintf("%#v", this.Deployment)+",\n") - s = append(s, "Group: "+fmt.Sprintf("%#v", this.Group)+",\n") - s = append(s, "Seq: "+fmt.Sprintf("%#v", this.Seq)+",\n") + s = append(s, "OrderID: "+strings.Replace(this.OrderID.GoString(), `&`, ``, 1)+",\n") s = append(s, "EndAt: "+fmt.Sprintf("%#v", this.EndAt)+",\n") s = append(s, "}") return strings.Join(s, "") @@ -2311,16 +2446,26 @@ func (this *Orders) GoString() string { s = append(s, "}") return strings.Join(s, "") } -func (this *Fulfillment) GoString() string { +func (this *FulfillmentID) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 10) - s = append(s, "&types.Fulfillment{") + s := make([]string, 0, 8) + s = append(s, "&types.FulfillmentID{") s = append(s, "Deployment: "+fmt.Sprintf("%#v", this.Deployment)+",\n") s = append(s, "Group: "+fmt.Sprintf("%#v", this.Group)+",\n") s = append(s, "Order: "+fmt.Sprintf("%#v", this.Order)+",\n") s = append(s, "Provider: "+fmt.Sprintf("%#v", this.Provider)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Fulfillment) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&types.Fulfillment{") + s = append(s, "FulfillmentID: "+strings.Replace(this.FulfillmentID.GoString(), `&`, ``, 1)+",\n") s = append(s, "Price: "+fmt.Sprintf("%#v", this.Price)+",\n") s = append(s, "State: "+fmt.Sprintf("%#v", this.State)+",\n") s = append(s, "}") @@ -2330,12 +2475,9 @@ func (this *TxCreateFulfillment) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 9) + s := make([]string, 0, 6) s = append(s, "&types.TxCreateFulfillment{") - s = append(s, "Deployment: "+fmt.Sprintf("%#v", this.Deployment)+",\n") - s = append(s, "Group: "+fmt.Sprintf("%#v", this.Group)+",\n") - s = append(s, "Order: "+fmt.Sprintf("%#v", this.Order)+",\n") - s = append(s, "Provider: "+fmt.Sprintf("%#v", this.Provider)+",\n") + s = append(s, "FulfillmentID: "+strings.Replace(this.FulfillmentID.GoString(), `&`, ``, 1)+",\n") s = append(s, "Price: "+fmt.Sprintf("%#v", this.Price)+",\n") s = append(s, "}") return strings.Join(s, "") @@ -2346,20 +2488,30 @@ func (this *TxCloseFulfillment) GoString() string { } s := make([]string, 0, 5) s = append(s, "&types.TxCloseFulfillment{") - s = append(s, "Fulfillment: "+fmt.Sprintf("%#v", this.Fulfillment)+",\n") + s = append(s, "FulfillmentID: "+strings.Replace(this.FulfillmentID.GoString(), `&`, ``, 1)+",\n") s = append(s, "}") return strings.Join(s, "") } -func (this *Lease) GoString() string { +func (this *LeaseID) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 10) - s = append(s, "&types.Lease{") + s := make([]string, 0, 8) + s = append(s, "&types.LeaseID{") s = append(s, "Deployment: "+fmt.Sprintf("%#v", this.Deployment)+",\n") s = append(s, "Group: "+fmt.Sprintf("%#v", this.Group)+",\n") s = append(s, "Order: "+fmt.Sprintf("%#v", this.Order)+",\n") s = append(s, "Provider: "+fmt.Sprintf("%#v", this.Provider)+",\n") + s = append(s, "}") + return strings.Join(s, "") +} +func (this *Lease) GoString() string { + if this == nil { + return "nil" + } + s := make([]string, 0, 7) + s = append(s, "&types.Lease{") + s = append(s, "LeaseID: "+strings.Replace(this.LeaseID.GoString(), `&`, ``, 1)+",\n") s = append(s, "Price: "+fmt.Sprintf("%#v", this.Price)+",\n") s = append(s, "State: "+fmt.Sprintf("%#v", this.State)+",\n") s = append(s, "}") @@ -2369,12 +2521,9 @@ func (this *TxCreateLease) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 9) + s := make([]string, 0, 6) s = append(s, "&types.TxCreateLease{") - s = append(s, "Deployment: "+fmt.Sprintf("%#v", this.Deployment)+",\n") - s = append(s, "Group: "+fmt.Sprintf("%#v", this.Group)+",\n") - s = append(s, "Order: "+fmt.Sprintf("%#v", this.Order)+",\n") - s = append(s, "Provider: "+fmt.Sprintf("%#v", this.Provider)+",\n") + s = append(s, "LeaseID: "+strings.Replace(this.LeaseID.GoString(), `&`, ``, 1)+",\n") s = append(s, "Price: "+fmt.Sprintf("%#v", this.Price)+",\n") s = append(s, "}") return strings.Join(s, "") @@ -2385,7 +2534,7 @@ func (this *TxCloseLease) GoString() string { } s := make([]string, 0, 5) s = append(s, "&types.TxCloseLease{") - s = append(s, "Lease: "+fmt.Sprintf("%#v", this.Lease)+",\n") + s = append(s, "LeaseID: "+strings.Replace(this.LeaseID.GoString(), `&`, ``, 1)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -4160,7 +4309,7 @@ func (m *GroupSpec) Unmarshal(dAtA []byte) error { } return nil } -func (m *DeploymentGroup) Unmarshal(dAtA []byte) error { +func (m *DeploymentGroupID) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4183,10 +4332,10 @@ func (m *DeploymentGroup) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: DeploymentGroup: wiretype end group for non-group") + return fmt.Errorf("proto: DeploymentGroupID: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: DeploymentGroup: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: DeploymentGroupID: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4238,6 +4387,86 @@ func (m *DeploymentGroup) Unmarshal(dAtA []byte) error { break } } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *DeploymentGroup) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: DeploymentGroup: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: DeploymentGroup: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field DeploymentGroupID", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.DeploymentGroupID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field OrderTTL", wireType) @@ -4898,7 +5127,7 @@ func (m *TxCloseDeployment) Unmarshal(dAtA []byte) error { } return nil } -func (m *Order) Unmarshal(dAtA []byte) error { +func (m *OrderID) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4921,10 +5150,10 @@ func (m *Order) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Order: wiretype end group for non-group") + return fmt.Errorf("proto: OrderID: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Order: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: OrderID: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4995,44 +5224,6 @@ func (m *Order) Unmarshal(dAtA []byte) error { break } } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndAt", wireType) - } - m.EndAt = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EndAt |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= (Order_OrderState(b) & 0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -5054,7 +5245,7 @@ func (m *Order) Unmarshal(dAtA []byte) error { } return nil } -func (m *TxCreateOrder) Unmarshal(dAtA []byte) error { +func (m *Order) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5077,17 +5268,17 @@ func (m *TxCreateOrder) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TxCreateOrder: wiretype end group for non-group") + return fmt.Errorf("proto: Order: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TxCreateOrder: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Order: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deployment", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OrderID", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5097,27 +5288,27 @@ func (m *TxCreateOrder) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Deployment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OrderID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EndAt", wireType) } - m.Group = 0 + m.EndAt = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5127,35 +5318,16 @@ func (m *TxCreateOrder) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Group |= (uint64(b) & 0x7F) << shift + m.EndAt |= (int64(b) & 0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Seq", wireType) - } - m.Seq = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Seq |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndAt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } - m.EndAt = 0 + m.State = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5165,7 +5337,7 @@ func (m *TxCreateOrder) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.EndAt |= (int64(b) & 0x7F) << shift + m.State |= (Order_OrderState(b) & 0x7F) << shift if b < 0x80 { break } @@ -5191,7 +5363,7 @@ func (m *TxCreateOrder) Unmarshal(dAtA []byte) error { } return nil } -func (m *Orders) Unmarshal(dAtA []byte) error { +func (m *TxCreateOrder) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5214,15 +5386,15 @@ func (m *Orders) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Orders: wiretype end group for non-group") + return fmt.Errorf("proto: TxCreateOrder: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Orders: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: TxCreateOrder: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field OrderID", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -5246,22 +5418,40 @@ func (m *Orders) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Items = append(m.Items, &Order{}) - if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.OrderID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTypes(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTypes + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EndAt", wireType) } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF + m.EndAt = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EndAt |= (int64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF } iNdEx += skippy } @@ -5272,7 +5462,7 @@ func (m *Orders) Unmarshal(dAtA []byte) error { } return nil } -func (m *Fulfillment) Unmarshal(dAtA []byte) error { +func (m *Orders) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5295,10 +5485,91 @@ func (m *Fulfillment) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Fulfillment: wiretype end group for non-group") + return fmt.Errorf("proto: Orders: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Fulfillment: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Orders: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Items", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTypes + } + postIndex := iNdEx + msglen + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Items = append(m.Items, &Order{}) + if err := m.Items[len(m.Items)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *FulfillmentID) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: FulfillmentID: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: FulfillmentID: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5399,44 +5670,6 @@ func (m *Fulfillment) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) - } - m.Price = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Price |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= (Fulfillment_FulfillmentState(b) & 0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -5458,7 +5691,7 @@ func (m *Fulfillment) Unmarshal(dAtA []byte) error { } return nil } -func (m *TxCreateFulfillment) Unmarshal(dAtA []byte) error { +func (m *Fulfillment) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5481,17 +5714,17 @@ func (m *TxCreateFulfillment) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TxCreateFulfillment: wiretype end group for non-group") + return fmt.Errorf("proto: Fulfillment: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TxCreateFulfillment: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Fulfillment: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deployment", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FulfillmentID", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5501,27 +5734,27 @@ func (m *TxCreateFulfillment) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Deployment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.FulfillmentID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } - m.Group = 0 + m.Price = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5531,16 +5764,16 @@ func (m *TxCreateFulfillment) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Group |= (uint64(b) & 0x7F) << shift + m.Price |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } - m.Order = 0 + m.State = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5550,16 +5783,66 @@ func (m *TxCreateFulfillment) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Order |= (uint64(b) & 0x7F) << shift + m.State |= (Fulfillment_FulfillmentState(b) & 0x7F) << shift if b < 0x80 { break } } - case 4: + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxCreateFulfillment) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TxCreateFulfillment: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxCreateFulfillment: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FulfillmentID", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5569,23 +5852,23 @@ func (m *TxCreateFulfillment) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Provider.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.FulfillmentID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 5: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } @@ -5656,9 +5939,9 @@ func (m *TxCloseFulfillment) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Fulfillment", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field FulfillmentID", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5668,19 +5951,19 @@ func (m *TxCloseFulfillment) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Fulfillment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.FulfillmentID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -5705,7 +5988,7 @@ func (m *TxCloseFulfillment) Unmarshal(dAtA []byte) error { } return nil } -func (m *Lease) Unmarshal(dAtA []byte) error { +func (m *LeaseID) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5728,10 +6011,10 @@ func (m *Lease) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: Lease: wiretype end group for non-group") + return fmt.Errorf("proto: LeaseID: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: Lease: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: LeaseID: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -5832,44 +6115,6 @@ func (m *Lease) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) - } - m.Price = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Price |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) - } - m.State = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTypes - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.State |= (Lease_LeaseState(b) & 0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := skipTypes(dAtA[iNdEx:]) @@ -5891,7 +6136,7 @@ func (m *Lease) Unmarshal(dAtA []byte) error { } return nil } -func (m *TxCreateLease) Unmarshal(dAtA []byte) error { +func (m *Lease) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -5914,17 +6159,17 @@ func (m *TxCreateLease) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: TxCreateLease: wiretype end group for non-group") + return fmt.Errorf("proto: Lease: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: TxCreateLease: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Lease: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Deployment", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LeaseID", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5934,27 +6179,27 @@ func (m *TxCreateLease) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Deployment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LeaseID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex case 2: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Group", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } - m.Group = 0 + m.Price = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5964,16 +6209,16 @@ func (m *TxCreateLease) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Group |= (uint64(b) & 0x7F) << shift + m.Price |= (uint32(b) & 0x7F) << shift if b < 0x80 { break } } case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Order", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field State", wireType) } - m.Order = 0 + m.State = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -5983,16 +6228,66 @@ func (m *TxCreateLease) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Order |= (uint64(b) & 0x7F) << shift + m.State |= (Lease_LeaseState(b) & 0x7F) << shift if b < 0x80 { break } } - case 4: + default: + iNdEx = preIndex + skippy, err := skipTypes(dAtA[iNdEx:]) + if err != nil { + return err + } + if skippy < 0 { + return ErrInvalidLengthTypes + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *TxCreateLease) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTypes + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: TxCreateLease: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: TxCreateLease: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Provider", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LeaseID", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -6002,23 +6297,23 @@ func (m *TxCreateLease) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Provider.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LeaseID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 5: + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field Price", wireType) } @@ -6089,9 +6384,9 @@ func (m *TxCloseLease) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Lease", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field LeaseID", wireType) } - var byteLen int + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTypes @@ -6101,19 +6396,19 @@ func (m *TxCloseLease) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - byteLen |= (int(b) & 0x7F) << shift + msglen |= (int(b) & 0x7F) << shift if b < 0x80 { break } } - if byteLen < 0 { + if msglen < 0 { return ErrInvalidLengthTypes } - postIndex := iNdEx + byteLen + postIndex := iNdEx + msglen if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.Lease.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.LeaseID.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -7026,106 +7321,108 @@ var ( func init() { proto.RegisterFile("types/types.proto", fileDescriptorTypes) } var fileDescriptorTypes = []byte{ - // 1602 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe4, 0x58, 0x4f, 0x6f, 0x1c, 0xc5, - 0x12, 0xdf, 0xd9, 0xdd, 0xd9, 0x3f, 0x65, 0x6f, 0x32, 0xee, 0xf8, 0xf9, 0xed, 0x8b, 0x22, 0x27, - 0x6f, 0xde, 0x93, 0x9e, 0x9f, 0x12, 0xdb, 0x91, 0xf3, 0x9e, 0x48, 0x48, 0x84, 0x62, 0xaf, 0xd7, - 0x59, 0x83, 0xb3, 0xb6, 0xda, 0xeb, 0x70, 0x44, 0xe3, 0xdd, 0xb6, 0x3d, 0xf2, 0xee, 0xcc, 0x66, - 0x66, 0xd6, 0xd8, 0x9f, 0x00, 0x21, 0xb8, 0xf1, 0x01, 0x10, 0x12, 0x07, 0x3e, 0x01, 0x07, 0x0e, - 0x9c, 0x11, 0x27, 0x8e, 0x11, 0x87, 0xa0, 0xe4, 0x02, 0x47, 0x38, 0x71, 0x02, 0xa1, 0xa9, 0xee, - 0x9e, 0xe9, 0x99, 0x5d, 0x07, 0xb2, 0x31, 0x08, 0x85, 0xcb, 0xa8, 0xab, 0xba, 0xba, 0xba, 0xaa, - 0xfa, 0x57, 0x35, 0x5d, 0x0d, 0x53, 0xc1, 0x49, 0x9f, 0xf9, 0x8b, 0xf8, 0x5d, 0xe8, 0x7b, 0x6e, - 0xe0, 0x12, 0x1d, 0x89, 0x8b, 0xf3, 0xfb, 0x76, 0x70, 0x30, 0xd8, 0x5d, 0x68, 0xbb, 0xbd, 0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 0x66, 0x3b, 0x8e, 0x1d, 0x84, 0x3f, 0x91, 0x76, 0x7f, 0x80, 0x5e, 0x54, 0x68, 0x38, 0x0c, 0x91, - 0xd4, 0x63, 0x3d, 0xd7, 0x3b, 0x41, 0x83, 0x2a, 0x54, 0x50, 0x84, 0x40, 0xbe, 0x63, 0xfb, 0x87, - 0x02, 0x5f, 0x38, 0x16, 0x21, 0xee, 0x43, 0x45, 0xea, 0xbc, 0xe7, 0xb9, 0x83, 0x3e, 0x99, 0x87, - 0xfc, 0xc0, 0xb1, 0x03, 0xd4, 0x1a, 0xe7, 0xba, 0xba, 0xaf, 0xb0, 0x17, 0xc5, 0x42, 0x4b, 0x31, - 0xb3, 0xc5, 0x86, 0x9c, 0x08, 0xb9, 0x7d, 0xcf, 0x16, 0x09, 0x58, 0xa1, 0x9c, 0x10, 0x3b, 0xd6, - 0x60, 0x6a, 0x28, 0x04, 0xa1, 0x81, 0x8e, 0xd5, 0xe3, 0xbf, 0xa7, 0x32, 0xc5, 0x71, 0xa8, 0xe4, - 0xc8, 0xea, 0x0e, 0x98, 0x08, 0x2e, 0x27, 0x84, 0x92, 0x77, 0x35, 0x28, 0xa3, 0xbd, 0xdb, 0x7d, - 0xd6, 0x26, 0x2b, 0x30, 0xe9, 0xb1, 0x87, 0x03, 0xdb, 0x63, 0x61, 0xd9, 0x92, 0xe8, 0xf8, 0xb5, - 0x80, 0x27, 0xd6, 0x90, 0x9b, 0x50, 0xf6, 0x84, 0x93, 0x7e, 0x35, 0x8b, 0x0a, 0xa6, 0x53, 0xce, - 0xe3, 0x86, 0x12, 0x63, 0x91, 0xb0, 0xf9, 0x41, 0x0e, 0xce, 0xc7, 0x15, 0x98, 0x47, 0x71, 0x0b, - 0xa0, 0x13, 0x57, 0xf2, 0x71, 0x71, 0xa6, 0xe8, 0x08, 0x0f, 0xdb, 0x67, 0x0f, 0x45, 0xa5, 0x0b, - 0x87, 0xe4, 0x22, 0x94, 0xdc, 0xf0, 0x97, 0xd8, 0x6a, 0x6d, 0x60, 0x9c, 0x73, 0x34, 0xa2, 0xc9, - 0x32, 0xe8, 0x7e, 0x60, 0x05, 0x1c, 0x40, 0xe7, 0x96, 0xae, 0x0a, 0x4f, 0x52, 0x66, 0xa6, 0xe9, - 0xed, 0x70, 0x09, 0xe5, 0x2b, 0x87, 0x82, 0xaa, 0xbf, 0x68, 0x50, 0x0b, 0xcf, 0x13, 0xd4, 0x5b, - 0x30, 0x3d, 0xca, 0x38, 0x52, 0x82, 0xfc, 0xe6, 0x56, 0xbd, 0x69, 0x64, 0xc8, 0x04, 0x14, 0x37, - 0xe9, 0x6a, 0x9d, 0xd6, 0x57, 0x0d, 0x8d, 0x00, 0x14, 0x6a, 0x1b, 0x9b, 0xdb, 0xf5, 0x55, 0x23, - 0x17, 0xd5, 0x0e, 0x23, 0xa5, 0xc0, 0x27, 0xd7, 0x40, 0xb7, 0x03, 0xd6, 0x93, 0x00, 0x99, 0x19, - 0x1d, 0x15, 0xca, 0x85, 0xcc, 0xf7, 0xb3, 0x00, 0xca, 0x9f, 0xf5, 0x2c, 0x0b, 0x70, 0x03, 0x0a, - 0x01, 0x73, 0x2c, 0x91, 0x36, 0xe3, 0xa8, 0x12, 0xeb, 0xc9, 0x2b, 0xf2, 0xa0, 0x73, 0x78, 0xd0, - 0xff, 0x1c, 0x72, 0x49, 0x19, 0xaa, 0xc7, 0x6b, 0xfe, 0x57, 0x05, 0x2d, 0x8f, 0x2d, 0x40, 0x61, - 0xb9, 0xd6, 0x5a, 0x7f, 0x50, 0x37, 0x32, 0x4a, 0x40, 0xb3, 0x22, 0xa0, 0x77, 0x60, 0x22, 0x5e, - 0xe0, 0x93, 0xf9, 0x64, 0x2c, 0xa7, 0x86, 0x36, 0x16, 0x67, 0x2a, 0x82, 0xf9, 0x99, 0x06, 0x64, - 0xf8, 0x86, 0xa8, 0x04, 0x42, 0x7b, 0xc1, 0x40, 0x44, 0x25, 0x33, 0xab, 0xde, 0x70, 0x9f, 0x95, - 0x23,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0xd4, 0x13, 0x8e, - 0x8b, 0x17, 0x3e, 0xd9, 0xae, 0x47, 0xf1, 0x88, 0x04, 0xcc, 0x9b, 0x50, 0x92, 0x5c, 0x72, 0x2d, - 0xba, 0x97, 0x69, 0x89, 0x8e, 0x41, 0x0a, 0xf0, 0x4b, 0xba, 0xbc, 0x9b, 0xbd, 0x09, 0x95, 0xc4, - 0xc4, 0xc8, 0x56, 0x72, 0x09, 0x4a, 0x3e, 0xf3, 0x8e, 0xec, 0xb8, 0xb7, 0x9b, 0x49, 0x29, 0xdd, - 0xe6, 0xd3, 0x34, 0x92, 0x33, 0x3f, 0xd5, 0xe2, 0x93, 0x13, 0xb3, 0xa7, 0xb5, 0xa9, 0x76, 0xcf, - 0xda, 0x8f, 0xda, 0x54, 0x24, 0xa2, 0x36, 0x3a, 0xf7, 0x9c, 0x6d, 0x74, 0x5e, 0x6d, 0xa3, 0xff, - 0x07, 0x05, 0x76, 0xdc, 0x77, 0x7d, 0x26, 0x9a, 0xaf, 0x4b, 0xa3, 0x8d, 0xae, 0xa3, 0x0c, 0x15, - 0xb2, 0xa6, 0x0f, 0x7f, 0x1b, 0x29, 0x10, 0x5a, 0xdf, 0x77, 0xbd, 0x40, 0x3c, 0x18, 0xe0, 0x98, - 0xe7, 0x8e, 0x2b, 0x1e, 0xb0, 0xca, 0x94, 0x13, 0xa4, 0x0a, 0x45, 0x11, 0x07, 0xf9, 0xb0, 0x23, - 0x48, 0x32, 0x03, 0x85, 0xfd, 0xae, 0xbb, 0x6b, 0x75, 0xd1, 0xd2, 0x12, 0x15, 0xd4, 0x8a, 0xf1, - 0xe8, 0xc9, 0xac, 0xf6, 0xfd, 0x93, 0x59, 0xed, 0xab, 0xa7, 0xb3, 0xda, 0xa3, 0xa7, 0xb3, 0xda, - 0x6e, 0x01, 0x55, 0xdd, 0xf8, 0x25, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xde, 0xf5, 0x6d, 0x77, 0x17, - 0x00, 0x00, + // 1641 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xdc, 0x58, 0x4f, 0x6f, 0x1b, 0x45, + 0x14, 0xf7, 0xae, 0xbd, 0xfe, 0xf3, 0x12, 0xb7, 0x9b, 0x69, 0x68, 0x4d, 0x55, 0x25, 0x65, 0x8b, + 0x44, 0x50, 0xdb, 0xa4, 0x4a, 0x41, 0xb4, 0xb4, 0x42, 0x8d, 0x1d, 0xa7, 0x0e, 0xa4, 0x4e, 0x34, + 0x71, 0xe0, 0xc0, 0x01, 0x6d, 0xec, 0x49, 0xba, 0x8a, 0xbd, 0xeb, 0xee, 0xac, 0x43, 0x72, 0xe0, + 0x8c, 0x10, 0x7c, 0x04, 0x2e, 0x48, 0x1c, 0xb8, 0x70, 0xe5, 0xc0, 0x27, 0x40, 0x70, 0xe9, 0xb1, + 0x02, 0xa9, 0xa8, 0xe5, 0xc2, 0x91, 0x4f, 0x80, 0xd0, 0xce, 0x9f, 0xdd, 0xd9, 0xb5, 0x53, 0x1a, + 0x37, 0xe5, 0xc0, 0x65, 0x35, 0xef, 0xcd, 0x9b, 0xdf, 0xbc, 0x79, 0xff, 0x76, 0xde, 0xc0, 0x54, + 0x70, 0xd8, 0x27, 0x74, 0x81, 0x7d, 0xe7, 0xfb, 0xbe, 0x17, 0x78, 0xc8, 0x60, 0xc4, 0xf9, 0xab, + 0xbb, 0x4e, 0x70, 0x7f, 0xb0, 0x3d, 0xdf, 0xf6, 0x7a, 0x0b, 0xbb, 0xde, 0xae, 0xb7, 0xc0, 0x66, + 0xb7, 0x07, 0x3b, 0x8c, 0x62, 0x04, 0x1b, 0xf1, 0x55, 0xd6, 0x2d, 0x28, 0xdc, 0x25, 0x2e, 0xa1, + 0x0e, 0x45, 0xd7, 0xa0, 0x68, 0xb7, 0xdb, 0xde, 0xc0, 0x0d, 0x68, 0x45, 0xbb, 0x98, 0x9d, 0x9b, + 0x58, 0x3c, 0x35, 0xcf, 0x37, 0x58, 0xe2, 0xec, 0x6a, 0xee, 0xa7, 0xc7, 0xb3, 0x19, 0x1c, 0x49, + 0x59, 0x3b, 0xa0, 0xb7, 0x0e, 0x90, 0x09, 0xd9, 0x3d, 0x72, 0x58, 0xd1, 0x2e, 0x6a, 0x73, 0x93, + 0x38, 0x1c, 0xa2, 0x0b, 0x50, 0xa2, 0xce, 0xae, 0x6b, 0x07, 0x03, 0x9f, 0x54, 0x74, 0xc6, 0x8f, + 0x19, 0xe8, 0x1a, 0x14, 0xfa, 0xf6, 0x61, 0xd7, 0xb3, 0x3b, 0x95, 0xec, 0x45, 0x6d, 0x6e, 0x62, + 0xd1, 0x14, 0xdb, 0xb4, 0x0e, 0x36, 0x38, 0x5f, 0x6c, 0x24, 0xc5, 0xac, 0xcf, 0x0d, 0x28, 0x45, + 0x93, 0x68, 0x1a, 0x0c, 0xd7, 0x73, 0xdb, 0x84, 0xed, 0x98, 0xc3, 0x9c, 0x40, 0x6f, 0x40, 0x3e, + 0x38, 0xd8, 0x24, 0x6e, 0x87, 0x6d, 0x38, 0xb1, 0x58, 0x8e, 0x40, 0x43, 0x66, 0x23, 0x83, 0xc5, + 0x34, 0xfa, 0x00, 0x50, 0x70, 0x50, 0xf3, 0x89, 0x1d, 0x90, 0x65, 0xd2, 0xef, 0x7a, 0x87, 0x3d, + 0xe2, 0x06, 0x42, 0x93, 0x57, 0xa3, 0x45, 0x69, 0x81, 0x46, 0x06, 0x8f, 0x58, 0x86, 0x6e, 0x43, + 0x59, 0x72, 0xd7, 0xfd, 0x0e, 0xf1, 0x2b, 0x39, 0x86, 0x33, 0x9d, 0xc2, 0x61, 0x73, 0x8d, 0x0c, + 0x4e, 0x0a, 0xa3, 0x26, 0x9c, 0x91, 0x8c, 0x95, 0x41, 0x77, 0xc7, 0xe9, 0x76, 0x99, 0x2e, 0x06, + 0xc3, 0x38, 0x9f, 0xc2, 0x50, 0x24, 0x1a, 0x19, 0x3c, 0x6a, 0xa1, 0xaa,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15, 0x72, 0x03, 0xd7, 0x09, 0x18, 0x6a, 0x9c, + 0xeb, 0xea, 0xbe, 0x42, 0x5f, 0x26, 0x16, 0x6a, 0xca, 0x32, 0x5b, 0x6c, 0xc8, 0x89, 0x90, 0xdb, + 0xf7, 0x1d, 0x91, 0x80, 0x65, 0xcc, 0x09, 0xb1, 0x63, 0x0d, 0xa6, 0x86, 0x4c, 0x10, 0x2a, 0xe8, + 0xda, 0x3d, 0xfe, 0x7b, 0x2a, 0x61, 0x36, 0x0e, 0x41, 0xf6, 0xed, 0xee, 0x80, 0x08, 0xe3, 0x72, + 0x42, 0x80, 0x7c, 0xa1, 0x41, 0x89, 0xe9, 0xbb, 0xd9, 0x27, 0x6d, 0x54, 0x85, 0x49, 0x9f, 0x3c, + 0x18, 0x38, 0x3e, 0x09, 0xcb, 0x96, 0x8c, 0x8e, 0x7f, 0x33, 0x78, 0x62, 0x0d, 0xba, 0x01, 0x25, + 0x5f, 0x1c, 0x92, 0x56, 0x74, 0x06, 0x30, 0x9d, 0x3a, 0x3c, 0xdb, 0x50, 0xc6, 0x58, 0x24, 0x6c, + 0x7d, 0x06, 0x53, 0x71, 0x01, 0x66, 0x32, 0xab, 0xcb, 0x68, 0x03, 0xa0, 0x13, 0x97, 0xf2, 0x71, + 0x03, 0x4d, 0xc1, 0x08, 0xbd, 0x4d, 0xc9, 0x03, 0x51, 0xea, 0xc2, 0xa1, 0x30, 0xc5, 0x1f, 0x3a, + 0x9c, 0x4e, 0xed, 0x8f, 0x16, 0x41, 0x77, 0x3a, 0xc2, 0x85, 0xd2, 0x0c, 0x43, 0x3a, 0x56, 0x8b, + 0xa1, 0x3e, 0x0f, 0x1f, 0xcf, 0x6a, 0x58, 0x77, 0x3a, 0xe8, 0x3c, 0x14, 0xbd, 0xf0, 0x0f, 0xdb, + 0x6a, 0xad, 0x31, 0xb7, 0x65, 0x71, 0x44, 0xa3, 0x25, 0x30, 0x68, 0x60, 0x07, 0x3c, 0x1e, 0x4f, + 0x2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x18, 0x2c, 0x99, 0xe4, + 0xad, 0x9d, 0x11, 0x68, 0x0d, 0x8a, 0xf2, 0x3a, 0xc7, 0xfe, 0x3e, 0xe3, 0xec, 0x1d, 0x21, 0x08, + 0x13, 0xff, 0xa2, 0xc1, 0x84, 0xda, 0xe7, 0xcc, 0x2b, 0x16, 0x96, 0x3f, 0x94, 0x84, 0x0d, 0x86, + 0xed, 0xcc, 0xaf, 0x37, 0xba, 0x72, 0xbd, 0x41, 0x37, 0x93, 0xe1, 0x71, 0x69, 0x18, 0x48, 0x1d, + 0x27, 0x42, 0xe5, 0x6d, 0x30, 0xd3, 0x53, 0xcf, 0x1f, 0x30, 0x1f, 0xc3, 0x99, 0x11, 0xfd, 0xee, + 0xc9, 0x1c, 0xca, 0x5a, 0x66, 0x75, 0x36, 0xdd, 0x18, 0x1e, 0x13, 0xdb, 0xfa, 0x4d, 0x83, 0x02, + 0xeb, 0x0b, 0xff, 0x97, 0xe1, 0xf4, 0xb5, 0x06, 0x06, 0x7f, 0x0e, 0x18, 0x95, 0xaa, 0xe2, 0xdc, + 0xcf, 0x15, 0x42, 0x47, 0x54, 0x18, 0x06, 0xc1, 0xbf, 0x89, 0xb0, 0x79, 0x1d, 0x20, 0x66, 0x1e, + 0xf5, 0xbf, 0x55, 0x0b, 0xca, 0x89, 0x68, 0x69, 0xdd, 0x80, 0x49, 0xb5, 0xf7, 0x7f, 0x7e, 0xbc, + 0xb0, 0x14, 0xb1, 0x89, 0x23, 0x4b, 0x11, 0x9b, 0x95, 0xa5, 0xe8, 0x5b, 0x1d, 0x4e, 0xdf, 0xb3, + 0x5d, 0x67, 0x87, 0xd0, 0x00, 0x93, 0x07, 0x03, 0x42, 0x03, 0x54, 0x55, 0x1e, 0xce, 0xc6, 0x70, + 0x1d, 0x7b, 0x6a, 0x6b, 0x0e, 0x3d, 0xb5, 0x8d, 0x81, 0xa4, 0x3c, 0xce, 0x25, 0x23, 0x3a, 0x7b, + 0x02, 0x11, 0x7d, 0x19, 0x8a, 0x3d, 0x71, 0x70, 0xf1, 0x3a, 0x26, 0x5b, 0xdd, 0xc8, 0x1e, 0x91, + 0x80, 0x75, 0x03, 0x8a, 0x92, 0x8b, 0xae, 0x44, 0x97, 0x10, 0x2d, 0x71, 0x3d, 0x96, 0x02, 0xfc, + 0x46, 0x2a, 0x2f, 0x22, 0x1f, 0x41, 0x39, 0x31, 0x31, 0xb2, 0x0d, 0x5b, 0x84, 0x22, 0x25, 0xfe, + 0xbe, 0x13, 0xf7, 0x45, 0x67, 0x53, 0xa0, 0x9b, 0x7c, 0x1a, 0x47, 0x72, 0xd6, 0x0f, 0x5a, 0xec, + 0x39, 0x31, 0x7b, 0x54, 0x8b, 0xe7, 0xf4, 0xec, 0xdd, 0xa8, 0xc5, 0x63, 0x44, 0xd4, 0x82, 0x66, + 0x8f, 0xd9, 0x82, 0xe6, 0xd4, 0x16, 0xf4, 0x2d, 0xc8, 0x93, 0x83, 0xbe, 0x47, 0x89, 0xe8, 0x34, + 0x2e, 0x8c, 0x56, 0xba, 0xce, 0x64, 0xb0, 0x90, 0xb5, 0x28, 0xbc, 0x32, 0x52, 0x20, 0xd4, 0xbe, + 0xef, 0xf9, 0x81, 0x68, 0xb6, 0xd9, 0x98, 0x67, 0x87, 0x27, 0x1e, 0x7f, 0x4a, 0x98, 0x13, 0xa8, + 0x02, 0x05, 0x61, 0x07, 0xf9, 0x28, 0x22, 0xc8, 0xb0, 0x3b, 0xdf, 0xed, 0x7a, 0xdb, 0x76, 0x97, + 0x69, 0x5a, 0xc4, 0x82, 0xaa, 0x9a, 0x8f, 0x9e, 0xcc, 0x68, 0x7f, 0x3d, 0x99, 0xd1, 0x1e, 0x3e, + 0x9d, 0xd1, 0x1e, 0x3d, 0x9d, 0xd1, 0xb6, 0xf3, 0x0c, 0xea, 0xfa, 0x3f, 0x01, 0x00, 0x00, 0xff, + 0xff, 0x32, 0x45, 0xef, 0xf8, 0xb3, 0x16, 0x00, 0x00, } diff --git a/types/types.proto b/types/types.proto index ed9c06895b..04e19976ae 100644 --- a/types/types.proto +++ b/types/types.proto @@ -104,18 +104,20 @@ message GroupSpec { repeated ResourceGroup resources = 2 [(gogoproto.nullable) = false]; } -message DeploymentGroup { +message DeploymentGroupID { option (gogoproto.compare) = true; - /* BEGIN ID FIELDS */ - // deployment address bytes deployment = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; // unique sequence over deployment uint64 seq = 2; +} - /* END ID FIELDS */ +message DeploymentGroup { + option (gogoproto.compare) = true; + + DeploymentGroupID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; // max number of blocks orders are open int64 orderTTL = 3; @@ -173,12 +175,10 @@ message TxCloseDeployment { ReasonCode reason = 2; } -message Order { +message OrderID { option (gogoproto.compare) = true; - /* BEGIN ID FIELDS */ - - // deployment address + // deployment bytes deployment = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; // deployment group sequence @@ -186,45 +186,38 @@ message Order { // order sequence uint64 seq = 3; +} - /* END ID FIELDS */ +message Order { + option (gogoproto.compare) = true; + + OrderID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; // maximum block number order can be open - int64 endAt = 4; + int64 endAt = 2; enum OrderState { OPEN = 0; MATCHED = 1; CLOSED = 2; } - OrderState state = 5; + OrderState state = 3; } message TxCreateOrder { - // deployment address - bytes deployment = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; - - // deployment group sequence - uint64 group = 2; - - // order sequence - uint64 seq = 3; - - /* END ID FIELDS */ + OrderID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; // maximum block number order can be open - int64 endAt = 4; + int64 endAt = 2; } message Orders { repeated Order items = 1; } -message Fulfillment { +message FulfillmentID { option (gogoproto.compare) = true; - /* BEGIN ID FIELDS */ - // deployment address bytes deployment = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; @@ -236,46 +229,35 @@ message Fulfillment { // provider address bytes provider = 4 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; +} - uint32 price = 5; +message Fulfillment { + option (gogoproto.compare) = true; - /* END ID FIELDS */ + FulfillmentID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; + + uint32 price = 2; enum FulfillmentState { OPEN = 0; MATCHED = 1; CLOSED = 2; } - FulfillmentState state = 6; + FulfillmentState state = 3; } message TxCreateFulfillment { - /* BEGIN ID FIELDS */ + FulfillmentID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; - // deployment address - bytes deployment = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; - - // deployment group sequence - uint64 group = 2; - - // order sequence - uint64 order = 3; - - // provider address - bytes provider = 4 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; - - uint32 price = 5; - - /* END ID FIELDS */ + uint32 price = 2; } message TxCloseFulfillment { - // fulfillment address - bytes fulfillment = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; + FulfillmentID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; } -message Lease { - /* BEGIN ID FIELDS */ +message LeaseID { + option (gogoproto.compare) = true; // deployment address bytes deployment = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; @@ -288,42 +270,31 @@ message Lease { // provider address bytes provider = 4 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; +} - // price of matching fulfillment - uint32 price = 5; +message Lease { - /* END ID FIELDS */ + LeaseID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; + + // price of matching fulfillment + uint32 price = 2; enum LeaseState { ACTIVE = 0; CLOSED = 2; } - LeaseState state = 6; + LeaseState state = 3; } message TxCreateLease { - /* BEGIN ID FIELDS */ - - // deployment address - bytes deployment = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; - - // deployment group sequence - uint64 group = 2; - - // order sequence - uint64 order = 3; - - // provider address - bytes provider = 4 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; + LeaseID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; // price of matching fulfillment - uint32 price = 5; - - /* END ID FIELDS */ + uint32 price = 2; } message TxCloseLease { - bytes lease = 1 [(gogoproto.customtype)="github.com/ovrclk/akash/types/base.Bytes",(gogoproto.nullable) = false]; + LeaseID id = 1 [(gogoproto.embed)=true,(gogoproto.nullable)=false]; } message Leases {