diff --git a/eth/api.go b/eth/api.go index 05277d8998d5..c0a110b353e5 100644 --- a/eth/api.go +++ b/eth/api.go @@ -299,6 +299,16 @@ func (api *PrivateAdminAPI) EtcdMoveLeader(name string) error { return metaapi.EtcdMoveLeader(name) } +// Get the latest logged work +func (api *PrivateAdminAPI) EtcdGetWork() (string, error) { + return metaapi.EtcdGetWork() +} + +// Remove the latest logged work +func (api *PrivateAdminAPI) EtcdDeleteWork() error { + return metaapi.EtcdDeleteWork() +} + // Synchronize with the peer func (api *PrivateAdminAPI) SynchroniseWith(id enode.ID) error { return api.eth.protocolManager.SynchroniseWith(id) diff --git a/internal/web3ext/web3ext.go b/internal/web3ext/web3ext.go index 0ff683aa56b7..02ad5ef043c8 100644 --- a/internal/web3ext/web3ext.go +++ b/internal/web3ext/web3ext.go @@ -249,6 +249,16 @@ web3._extend({ params: 1, inputFormatter: [null] }), + new web3._extend.Method({ + name: 'etcdGetWork', + call: 'admin_etcdGetWork', + params: 0 + }), + new web3._extend.Method({ + name: 'etcdDeleteWork', + call: 'admin_etcdDeleteWork', + params: 0 + }), ], properties: [ new web3._extend.Property({ diff --git a/metadium/admin.go b/metadium/admin.go index 25e8bc797ce3..237b530815fb 100644 --- a/metadium/admin.go +++ b/metadium/admin.go @@ -1441,6 +1441,8 @@ func init() { metaapi.EtcdRemoveMember = EtcdRemoveMember metaapi.EtcdJoin = EtcdJoin metaapi.EtcdMoveLeader = EtcdMoveLeader + metaapi.EtcdGetWork = EtcdGetWork + metaapi.EtcdDeleteWork = EtcdDeleteWork } /* EOF */ diff --git a/metadium/api/api.go b/metadium/api/api.go index d07464a7ea45..b3215388ea17 100644 --- a/metadium/api/api.go +++ b/metadium/api/api.go @@ -39,6 +39,8 @@ var ( EtcdRemoveMember func(name string) (string, error) EtcdJoin func(cluster string) error EtcdMoveLeader func(name string) error + EtcdGetWork func() (string, error) + EtcdDeleteWork func() error ) func SetMsgChannel(ch chan interface{}) { diff --git a/metadium/etcdutil.go b/metadium/etcdutil.go index 439989fef0dc..bfa563c46e43 100644 --- a/metadium/etcdutil.go +++ b/metadium/etcdutil.go @@ -639,4 +639,18 @@ func EtcdJoin(name string) error { return admin.etcdJoin(name) } +func EtcdGetWork() (string, error) { + if admin == nil { + return "", ErrNotRunning + } + return admin.etcdGet("metadium-work") +} + +func EtcdDeleteWork() error { + if admin == nil { + return ErrNotRunning + } + return admin.etcdDelete("metadium-work") +} + /* EOF */