From a9a009b95eb351174867d8a7439ab525cd4c4f27 Mon Sep 17 00:00:00 2001 From: Emehinola Idowu Date: Fri, 12 Jul 2019 16:54:43 +0100 Subject: [PATCH 1/6] Added sample comments to fix golint errors --- chaos/chaos-server.go | 4 ++++ chaos/chaos.go | 8 ++++++++ chaos/net-rpc-client.go | 7 +++++++ 3 files changed, 19 insertions(+) diff --git a/chaos/chaos-server.go b/chaos/chaos-server.go index ab64899..26ebb1b 100644 --- a/chaos/chaos-server.go +++ b/chaos/chaos-server.go @@ -34,7 +34,11 @@ import ( // const LockMaintenanceLoop = 1 * time.Minute // const LockCheckValidityInterval = 2 * time.Minute // + +// LockMaintenanceLoop is the locking time for maintenace loop const LockMaintenanceLoop = 1 * time.Second + +// LockCheckValidityInterval is the time to check validity interval const LockCheckValidityInterval = 5 * time.Second func startRPCServer(port int) { diff --git a/chaos/chaos.go b/chaos/chaos.go index 6fa5dca..34379e8 100644 --- a/chaos/chaos.go +++ b/chaos/chaos.go @@ -524,6 +524,7 @@ func testTwoClientsThatHaveReadLocksCrash(wg *sync.WaitGroup, ds *dsync.Dsync) { log.Println("**PASSED** testTwoClientsThatHaveReadLocksCrash") } +// RWLocker Interface type RWLocker interface { Lock(id, source string) RLock(id, source string) @@ -531,11 +532,13 @@ type RWLocker interface { RUnlock() } +// DRWMutexNoWriterStarvation Struct type DRWMutexNoWriterStarvation struct { excl *dsync.DRWMutex rw *dsync.DRWMutex } +// NewDRWMutexNoWriterStarvation function func NewDRWMutexNoWriterStarvation(name string, ds *dsync.Dsync) *DRWMutexNoWriterStarvation { return &DRWMutexNoWriterStarvation{ excl: dsync.NewDRWMutex(context.Background(), name+"-excl-no-writer-starvation", ds), @@ -543,6 +546,7 @@ func NewDRWMutexNoWriterStarvation(name string, ds *dsync.Dsync) *DRWMutexNoWrit } } +// Lock function func (d *DRWMutexNoWriterStarvation) Lock(id, source string) { d.excl.Lock(id+"-excl-no-writer-starvation", source) defer d.excl.Unlock() @@ -550,10 +554,12 @@ func (d *DRWMutexNoWriterStarvation) Lock(id, source string) { d.rw.Lock(id, source) } +// Unlock function func (d *DRWMutexNoWriterStarvation) Unlock() { d.rw.Unlock() } +// RLock function func (d *DRWMutexNoWriterStarvation) RLock(id, source string) { d.excl.Lock(id+"-excl-no-writer-starvation", source) defer d.excl.Unlock() @@ -561,6 +567,7 @@ func (d *DRWMutexNoWriterStarvation) RLock(id, source string) { d.rw.RLock(id, source) } +// RUnlock function func (d *DRWMutexNoWriterStarvation) RUnlock() { d.rw.RUnlock() } @@ -634,6 +641,7 @@ func testWriterStarvation(wg *sync.WaitGroup, noWriterStarvation bool, ds *dsync } } +// getSelfNode function func getSelfNode(rpcClnts []dsync.NetLocker, port int) int { index := -1 diff --git a/chaos/net-rpc-client.go b/chaos/net-rpc-client.go index f97b3a9..6bb834f 100644 --- a/chaos/net-rpc-client.go +++ b/chaos/net-rpc-client.go @@ -81,35 +81,42 @@ func (rpcClient *ReconnectRPCClient) Call(serviceMethod string, args interface{} return err } +// RLock function func (rpcClient *ReconnectRPCClient) RLock(args dsync.LockArgs) (status bool, err error) { err = rpcClient.Call("Dsync.RLock", &args, &status) return status, err } +// Lock function func (rpcClient *ReconnectRPCClient) Lock(args dsync.LockArgs) (status bool, err error) { err = rpcClient.Call("Dsync.Lock", &args, &status) return status, err } +// RUnlock function func (rpcClient *ReconnectRPCClient) RUnlock(args dsync.LockArgs) (status bool, err error) { err = rpcClient.Call("Dsync.RUnlock", &args, &status) return status, err } +// Unlock function func (rpcClient *ReconnectRPCClient) Unlock(args dsync.LockArgs) (status bool, err error) { err = rpcClient.Call("Dsync.Unlock", &args, &status) return status, err } +// ForceUnlock function func (rpcClient *ReconnectRPCClient) ForceUnlock(args dsync.LockArgs) (status bool, err error) { err = rpcClient.Call("Dsync.ForceUnlock", &args, &status) return status, err } +// ServerAddr function func (rpcClient *ReconnectRPCClient) ServerAddr() string { return rpcClient.addr } +// ServiceEndpoint function func (rpcClient *ReconnectRPCClient) ServiceEndpoint() string { return rpcClient.endpoint } From fbaaf453b1611c1749fa1a3f9ddfbbcebdb35c9b Mon Sep 17 00:00:00 2001 From: Idowu Emehinola Date: Sun, 28 Jul 2019 22:25:10 +0100 Subject: [PATCH 2/6] Corrected the spalling of 'maintenance' --- chaos/chaos-server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chaos/chaos-server.go b/chaos/chaos-server.go index 26ebb1b..44f0852 100644 --- a/chaos/chaos-server.go +++ b/chaos/chaos-server.go @@ -35,7 +35,7 @@ import ( // const LockCheckValidityInterval = 2 * time.Minute // -// LockMaintenanceLoop is the locking time for maintenace loop +// LockMaintenanceLoop is the locking time for maintenance loop const LockMaintenanceLoop = 1 * time.Second // LockCheckValidityInterval is the time to check validity interval From 4628e76be451ecd6146008cc9b30a0eb334f008c Mon Sep 17 00:00:00 2001 From: Idowu Emehinola Date: Sun, 28 Jul 2019 22:25:10 +0100 Subject: [PATCH 3/6] Corrected the spelling of 'maintenance' --- chaos/chaos-server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/chaos/chaos-server.go b/chaos/chaos-server.go index 26ebb1b..44f0852 100644 --- a/chaos/chaos-server.go +++ b/chaos/chaos-server.go @@ -35,7 +35,7 @@ import ( // const LockCheckValidityInterval = 2 * time.Minute // -// LockMaintenanceLoop is the locking time for maintenace loop +// LockMaintenanceLoop is the locking time for maintenance loop const LockMaintenanceLoop = 1 * time.Second // LockCheckValidityInterval is the time to check validity interval From 9a1c2e36b9a06c468474b6cf5b07b2aadc5ef0e3 Mon Sep 17 00:00:00 2001 From: Idowu Emehinola Date: Sun, 28 Jul 2019 22:45:00 +0100 Subject: [PATCH 4/6] removed comment from a private function --- chaos/chaos.go | 1 - 1 file changed, 1 deletion(-) diff --git a/chaos/chaos.go b/chaos/chaos.go index 34379e8..e5678a9 100644 --- a/chaos/chaos.go +++ b/chaos/chaos.go @@ -641,7 +641,6 @@ func testWriterStarvation(wg *sync.WaitGroup, noWriterStarvation bool, ds *dsync } } -// getSelfNode function func getSelfNode(rpcClnts []dsync.NetLocker, port int) int { index := -1 From ac43520e6990d9fb1c42b148b122826cf80573a3 Mon Sep 17 00:00:00 2001 From: Idowu Emehinola Date: Sun, 28 Jul 2019 22:58:48 +0100 Subject: [PATCH 5/6] Removed unneccessay white spaces --- chaos/chaos-server.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/chaos/chaos-server.go b/chaos/chaos-server.go index 44f0852..f05eeea 100644 --- a/chaos/chaos-server.go +++ b/chaos/chaos-server.go @@ -34,10 +34,8 @@ import ( // const LockMaintenanceLoop = 1 * time.Minute // const LockCheckValidityInterval = 2 * time.Minute // - // LockMaintenanceLoop is the locking time for maintenance loop const LockMaintenanceLoop = 1 * time.Second - // LockCheckValidityInterval is the time to check validity interval const LockCheckValidityInterval = 5 * time.Second From 4dc21a5618eae17f45a6c3b394a86ac0defe9637 Mon Sep 17 00:00:00 2001 From: Idowu Emehinola Date: Sun, 28 Jul 2019 23:01:34 +0100 Subject: [PATCH 6/6] Removed unneccessay white spaces --- chaos/chaos-server.go | 1 + 1 file changed, 1 insertion(+) diff --git a/chaos/chaos-server.go b/chaos/chaos-server.go index f05eeea..4e196d6 100644 --- a/chaos/chaos-server.go +++ b/chaos/chaos-server.go @@ -34,6 +34,7 @@ import ( // const LockMaintenanceLoop = 1 * time.Minute // const LockCheckValidityInterval = 2 * time.Minute // + // LockMaintenanceLoop is the locking time for maintenance loop const LockMaintenanceLoop = 1 * time.Second // LockCheckValidityInterval is the time to check validity interval