-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from mumez/feature/more-list-support
More list API support
- Loading branch information
Showing
19 changed files
with
210 additions
and
2 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lInsert.value.after..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
commands-lists | ||
lInsert: aKey value: aValue after: pivot | ||
^ self unifiedCommand: { | ||
'LINSERT'. | ||
aKey. | ||
'AFTER'. | ||
pivot. | ||
aValue } |
8 changes: 8 additions & 0 deletions
8
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lInsert.value.before..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
commands-lists | ||
lInsert: aKey value: aValue before: pivot | ||
^ self unifiedCommand: { | ||
'LINSERT'. | ||
aKey. | ||
'BEFORE'. | ||
pivot. | ||
aValue } |
15 changes: 15 additions & 0 deletions
15
...ry/RediStick-Core.package/RsRedisEndpoint.class/instance/lMoveFrom.removing.to.adding..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
commands-lists | ||
lMoveFrom: source removing: srcFromRightOrLeft to: destination adding: destToRightOrLeft | ||
| srcRightOrLeft destRightOrLeft | | ||
srcRightOrLeft := srcFromRightOrLeft | ||
ifNil: [ 'RIGHT' ] | ||
ifNotNil: [ srcFromRightOrLeft ]. "RIGHT or LEFT" | ||
destRightOrLeft := destToRightOrLeft | ||
ifNil: [ 'LEFT' ] | ||
ifNotNil: [ destToRightOrLeft ]. "RIGHT or LEFT" | ||
^ self unifiedCommand: { | ||
'LMOVE'. | ||
source. | ||
destination. | ||
srcRightOrLeft. | ||
destRightOrLeft } |
7 changes: 7 additions & 0 deletions
7
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lMoveFrom.to..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
commands-lists | ||
lMoveFrom: source to: destination | ||
^ self | ||
lMoveFrom: source | ||
removing: 'RIGHT' | ||
to: destination | ||
adding: 'LEFT' |
6 changes: 6 additions & 0 deletions
6
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lPop.count..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
commands-lists | ||
lPop: aKey count: count | ||
^ self unifiedCommand: { | ||
'LPOP'. | ||
aKey. | ||
count } |
8 changes: 8 additions & 0 deletions
8
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lPos.value..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
commands-lists | ||
lPos: aKey value: value | ||
^ self | ||
lPos: aKey | ||
value: value | ||
rank: nil | ||
count: nil | ||
maxlen: nil |
8 changes: 8 additions & 0 deletions
8
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lPos.value.count..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
commands-lists | ||
lPos: aKey value: value count: count | ||
^ self | ||
lPos: aKey | ||
value: value | ||
rank: nil | ||
count: count | ||
maxlen: nil |
8 changes: 8 additions & 0 deletions
8
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lPos.value.maxlen..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
commands-lists | ||
lPos: aKey value: value maxlen: maxlen | ||
^ self | ||
lPos: aKey | ||
value: value | ||
rank: nil | ||
count: nil | ||
maxlen: maxlen |
8 changes: 8 additions & 0 deletions
8
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lPos.value.rank..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
commands-lists | ||
lPos: aKey value: value rank: rank | ||
^ self | ||
lPos: aKey | ||
value: value | ||
rank: rank | ||
count: nil | ||
maxlen: nil |
21 changes: 21 additions & 0 deletions
21
...ry/RediStick-Core.package/RsRedisEndpoint.class/instance/lPos.value.rank.count.maxlen..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
commands-lists | ||
lPos: aKey value: value rank: rank count: count maxlen: maxlen | ||
| args | | ||
args := { | ||
'LPOS'. | ||
aKey. | ||
value } asOrderedCollection. | ||
rank ifNotNil: [ | ||
args addAll: { | ||
'RANK'. | ||
rank } ]. | ||
count ifNotNil: [ | ||
args addAll: { | ||
'COUNT'. | ||
count } ]. | ||
maxlen ifNotNil: [ | ||
args addAll: { | ||
'MAXLEN'. | ||
maxlen } ]. | ||
|
||
^ self unifiedCommand: args |
8 changes: 8 additions & 0 deletions
8
...itory/RediStick-Core.package/RsRedisEndpoint.class/instance/lPosBackward.value.maxlen..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
commands-lists | ||
lPosBackward: aKey value: value maxlen: maxlen | ||
^ self | ||
lPos: aKey | ||
value: value | ||
rank: -1 | ||
count: nil | ||
maxlen: maxlen |
6 changes: 6 additions & 0 deletions
6
repository/RediStick-Core.package/RsRedisEndpoint.class/instance/lPushx.value..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
commands-lists | ||
lPushx: aKey value: aValue | ||
^ self | ||
unifiedCommand: { 'LPUSHX' | ||
. aKey | ||
. aValue} |
2 changes: 1 addition & 1 deletion
2
repository/RediStick-Core.package/monticello.meta/categories.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SystemOrganization addCategory: #'RediStick-Core'! | ||
self packageOrganizer ensurePackage: #'RediStick-Core' withTags: #()! |
18 changes: 18 additions & 0 deletions
18
repository/RediStick-Tests.package/RsRedisEndpointTest.class/instance/testLIndex.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
tests | ||
testLIndex | ||
| listName elem | | ||
listName := 'testLIndex'. | ||
0 to: 4 do: [ :idx | | ||
stick endpoint rPush: listName value: idx. | ||
]. | ||
|
||
elem := stick endpoint lIndex: listName value: 2. | ||
self assert: elem equals: '2'. | ||
|
||
elem := stick endpoint lIndex: listName value: 4. | ||
self assert: elem equals: '4'. | ||
|
||
elem := stick endpoint lIndex: listName value: 10. | ||
self assert: elem equals: nil. | ||
|
||
|
18 changes: 18 additions & 0 deletions
18
repository/RediStick-Tests.package/RsRedisEndpointTest.class/instance/testLInsert.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
tests | ||
testLInsert | ||
| listName elems1 elems2 | | ||
listName := 'testLInsert'. | ||
#('one' 'two' 'three') do: [ :each | | ||
stick endpoint rPush: listName value: each. | ||
]. | ||
|
||
stick endpoint lInsert: listName value: 'val1' after: 'two'. | ||
elems1 := stick endpoint lRange: listName start: 0 end: -1. | ||
|
||
self assertCollection: elems1 asArray equals: #('one' 'two' 'val1' 'three'). | ||
|
||
stick endpoint lInsert: listName value: 'val2' before: 'two'. | ||
elems2 := stick endpoint lRange: listName start: 0 end: -1. | ||
|
||
self assertCollection: elems2 asArray equals: #('one' 'val2' 'two' 'val1' 'three') | ||
|
27 changes: 27 additions & 0 deletions
27
repository/RediStick-Tests.package/RsRedisEndpointTest.class/instance/testLMove.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
tests | ||
testLMove | ||
| listName1 listName2 elems1 elems2 | | ||
listName1 := 'testLMove1'. | ||
1 to: 3 do: [ :idx | | ||
stick endpoint rPush: listName1 value: idx. | ||
]. | ||
listName2 := 'testLMove2'. | ||
1 to: 3 do: [ :idx | | ||
stick endpoint rPush: listName2 value: idx*10. | ||
]. | ||
|
||
stick endpoint lMoveFrom: listName1 to: listName2. | ||
|
||
elems1 := stick endpoint lRange: listName1 start: 0 end: -1. | ||
elems2 := stick endpoint lRange: listName2 start: 0 end: -1. | ||
|
||
self assertCollection: elems1 asArray equals: #('1' '2'). | ||
self assertCollection: elems2 asArray equals: #('3' '10' '20' '30'). | ||
|
||
stick endpoint lMoveFrom: listName2 removing: 'LEFT' to: listName1 adding: 'RIGHT'. | ||
|
||
elems1 := stick endpoint lRange: listName1 start: 0 end: -1. | ||
elems2 := stick endpoint lRange: listName2 start: 0 end: -1. | ||
|
||
self assertCollection: elems1 asArray equals: #('1' '2' '3'). | ||
self assertCollection: elems2 asArray equals: #('10' '20' '30'). |
22 changes: 22 additions & 0 deletions
22
repository/RediStick-Tests.package/RsRedisEndpointTest.class/instance/testLPos.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
tests | ||
testLPos | ||
| listName pos positions | | ||
listName := 'testLPos'. | ||
0 to: 10 do: [ :idx | | ||
stick endpoint rPush: listName value: idx. | ||
]. | ||
0 to: 10 do: [ :idx | | ||
stick endpoint rPush: listName value: idx. | ||
]. | ||
|
||
pos := stick endpoint lPos: listName value: '2'. | ||
self assert: pos equals: 2. | ||
|
||
pos := stick endpoint lPosBackward: listName value: '2' maxlen: 10. | ||
self assert: pos equals: 13. | ||
|
||
pos := stick endpoint lPosBackward: listName value: '2' maxlen: 5. | ||
self assert: pos isNil. | ||
|
||
positions := stick endpoint lPos: listName value: '2' count: 0. | ||
self assertCollection: positions asArray equals: #(2 13) |
12 changes: 12 additions & 0 deletions
12
repository/RediStick-Tests.package/RsRedisEndpointTest.class/instance/testLPushPop.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
tests | ||
testLPushPop | ||
| listName elem elems | | ||
listName := 'testLPushPop'. | ||
stick endpoint lPush: listName value: 'val1'. | ||
stick endpoint lPush: listName value: 'val2'. | ||
stick endpoint lPush: listName value: 'val3'. | ||
elem := stick endpoint lPop: listName. | ||
self assert: elem equals: 'val3'. | ||
|
||
elems := stick endpoint lPop: listName count: 2. | ||
self assertCollection: elems asArray equals: #('val2' 'val1'). |
2 changes: 1 addition & 1 deletion
2
repository/RediStick-Tests.package/monticello.meta/categories.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
SystemOrganization addCategory: #'RediStick-Tests'! | ||
self packageOrganizer ensurePackage: #'RediStick-Tests' withTags: #()! |