dice icon indicating copy to clipboard operation
dice copied to clipboard

added RENAME Command

Open rkarthick15 opened this issue 1 year ago • 2 comments

Added support for Rename Command #253

rkarthick15 avatar Aug 06 '24 18:08 rkarthick15

@rkarthick15 please add the atomic rename API to the store and use it for evaluation the RENAME operation

JyotinderSingh avatar Aug 08 '24 04:08 JyotinderSingh

@JyotinderSingh

I am trying to create a new store API for rename, below is the sample snippet

func Rename(sourceKey string, destinationKey string, obj *Obj) bool {
	storeMutex.Lock()
	defer storeMutex.Unlock()
	keypoolMutex.Lock()
	defer keypoolMutex.Unlock()

	//Delete the destinationKey if exists 
	//create a new destinationKey and set the value
	//Delete the source Key

	return false
}

If this above method is correct, can we have a separate shared functions for Put and Delete operations?, so that rename, put , del function can also access the same shared function for PUT and DEL operations

rkarthick15 avatar Aug 08 '24 16:08 rkarthick15

@JyotinderSingh

I am trying to create a new store API for rename, below is the sample snippet


func Rename(sourceKey string, destinationKey string, obj *Obj) bool {

	storeMutex.Lock()

	defer storeMutex.Unlock()

	keypoolMutex.Lock()

	defer keypoolMutex.Unlock()



	//Delete the destinationKey if exists 

	//create a new destinationKey and set the value

	//Delete the source Key



	return false

}



If this above method is correct, can we have a separate shared functions for Put and Delete operations?, so that rename, put , del function can also access the same shared function for PUT and DEL operations

Sounds good, just make sure those functions aren't exported from the package.

JyotinderSingh avatar Aug 09 '24 03:08 JyotinderSingh

There are a few merge conflicts as well, please resolve them @rkarthick15

JyotinderSingh avatar Aug 10 '24 09:08 JyotinderSingh