Skip to content

Commit

Permalink
Merge pull request #184 from pharo-nosql/mongo-driver-v5
Browse files Browse the repository at this point in the history
Mongo driver v5
  • Loading branch information
estebanlm committed Sep 14, 2023
2 parents 9bf0fbe + 1f92b0d commit a47d48b
Show file tree
Hide file tree
Showing 81 changed files with 106 additions and 102 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/tests.yml
@@ -0,0 +1,29 @@
name: CI

on: [ push, pull_request, workflow_dispatch ]

jobs:
test:
strategy:
matrix:
pharo-version: [ Pharo64-10, Pharo64-11, Pharo64-12 ]
ston: [ .smalltalk.ston ]
mongodb-version: [ 5, 6 ]
os: [ ubuntu-latest ]
runs-on: ${{ matrix.os }}
name: ${{ matrix.pharo-version }}, ${{ matrix.mongodb-version }}
steps:
- uses: actions/checkout@v3

- name: Create mongoDB Docker container
run: sudo docker run -d -p 27017:27017 mongo:${{ matrix.mongodb-version }}

- name: Setup SmalltalkCI
uses: hpi-swa/setup-smalltalkCI@v1
with:
smalltalk-image: ${{ matrix.pharo-version }}

- name: Get Pharo and Run Tests
run: smalltalkci -s ${{ matrix.pharo-version }} ${{ matrix.ston }}
shell: bash
timeout-minutes: 40
5 changes: 1 addition & 4 deletions .smalltalk.ston
@@ -1,13 +1,10 @@
SmalltalkCISpec {
#preLoading: 'scripts/preLoading.st',
#loading : [
SCIMetacelloLoadSpec {
#baseline : 'Voyage',
#directory : 'mc',
#load : [ 'mongo tests', 'memory tests' ],
#platforms : [ #pharo ]
}
],
#preTesting: 'scripts/preTesting.st'
]
}

13 changes: 4 additions & 9 deletions README.md
@@ -1,15 +1,13 @@
Voyage [![Build Status](https://travis-ci.org/pharo-nosql/voyage.png)](http://travis-ci.org/pharo-nosql/voyage) [![Test Status](https://api.bob-bench.org/v1/badgeByUrl?branch=master&hosting=github&ci=travis-ci&repo=pharo-nosql%2Fvoyage)](https://bob-bench.org/r/gh/pharo-nosql/voyage)
Voyage
======


Voyage is an object persistence abstraction layer for Pharo.

[![CI](https://github.com/pharo-nosql/voyage/actions/workflows/tests.yml/badge.svg)](https://github.com/pharo-nosql/voyage/actions/workflows/tests.yml)

Install
-------

Just install it from you Pharo catalog.

You can also install it executing scripts:
You can install it executing scripts:

### Voyage-Mongo
```Smalltalk
Expand All @@ -19,8 +17,6 @@ Metacello new
load: 'mongo tests'.
```



### Voyage-EJDB
```Smalltalk
Metacello new
Expand Down Expand Up @@ -54,4 +50,3 @@ Documentation
### Pharo for the Enterprise book

Voyage is part of the upcoming "Pharo for the Enterprise 2" book, and Johan Fabry (along with Damien Cassou) has written a nice chapter on it: [HTML](https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/Voyage/Voyage.html) / [PDF](https://ci.inria.fr/pharo-contribution/job/EnterprisePharoBook/lastSuccessfulBuild/artifact/book-result/Voyage/Voyage.pdf)

@@ -1,9 +1,9 @@
accessing
baselines
baseline: spec
<baseline>

spec for: #common do: [
self magritte: spec.
self simpleRene: spec.
self persistenceQueries: spec.
self mongoTalk: spec.
self arangoDB: spec.
Expand All @@ -13,15 +13,16 @@ baseline: spec

spec
"core"
package: 'Voyage-Model-Core' with: [ spec requires: 'Magritte' ];
package: 'Voyage-Model-Core' with: [ spec requires: 'SimpleRene' ];
package: 'Voyage-Model-Tests' with: [ spec requires: 'Voyage-Model-Core' ];
package: 'Voyage-Memory-Core' with: [ spec requires: 'Voyage-Model-Core' ];
package: 'Voyage-Memory-Tests' with: [ spec requires: 'Voyage-Memory-Core' ];
package: 'Voyage-JSON' with: [ spec requires: #('Voyage-Model-Core' 'Magritte') ];
package: 'Voyage-JSON' with: [ spec requires: #('Voyage-Model-Core' 'SimpleRene') ];
package: 'Voyage-JSON-Tests' with: [ spec requires: 'Voyage-JSON' ];
"mongo"
package: 'Voyage-Mongo-Core' with: [ spec requires: #('MongoTalk' 'Voyage-Model-Core') ];
package: 'Voyage-Mongo-Tests';
package: 'Voyage-Mongo-Replication-Tests' with: [ spec requires: #('Voyage-Mongo-Tests') ];
package: 'Voyage-Mongo-MultipleImageTests' with: [ spec requires: #('Voyage-Mongo-Tests' 'ImageWorker') ];
"arango"
package: 'Voyage-Arango-Core' with: [ spec requires: #('ArangoDB' 'PersistenceQuery' 'Voyage-Model-Core') ];
Expand Down
@@ -1,4 +1,4 @@
accessing
external projects
ejdb: spec

spec baseline: 'EJDB' with: [
Expand Down

This file was deleted.

Expand Up @@ -2,6 +2,6 @@ external projects
mongoTalk: spec
spec
baseline: 'MongoTalk'
with: [ spec repository: 'github://pharo-nosql/mongotalk:1.26/mc';
with: [ spec repository: 'github://pharo-nosql/mongotalk:v2.0/mc';
loads: #( 'Client' ) ];
import: 'MongoTalk'
@@ -1,4 +1,4 @@
accessing
external projects
persistenceQueries: spec
spec
baseline: 'PersistenceQuery' with: [
Expand Down
@@ -0,0 +1,7 @@
external projects
simpleRene: spec

spec baseline: 'SimpleRene' with: [
spec
repository: 'github://pharo-contributions/SimpleRene';
loads: #( 'Core' ) ]

This file was deleted.

3 changes: 0 additions & 3 deletions mc/Voyage-JSON.package/MAContainer.extension/properties.json

This file was deleted.

2 changes: 1 addition & 1 deletion mc/Voyage-JSON.package/VOContainer.class/properties.json
Expand Up @@ -4,7 +4,7 @@
"instvars" : [ ],
"name" : "VOContainer",
"commentStamp" : "<historical>",
"super" : "MAContainer",
"super" : "SRContainer",
"traitcomposition" : "TVOPostLoad",
"type" : "normal",
"classinstvars" : [ ],
Expand Down
2 changes: 1 addition & 1 deletion mc/Voyage-JSON.package/VODescription.class/properties.json
Expand Up @@ -4,7 +4,7 @@
"instvars" : [ ],
"name" : "VODescription",
"commentStamp" : "<historical>",
"super" : "MADescription",
"super" : "SRDescription",
"traitcomposition" : "TVOPostLoad",
"type" : "normal",
"classinstvars" : [ ],
Expand Down
Expand Up @@ -3,8 +3,8 @@ build: aPragma in: aClass
| description |

description := aPragma method valueWithReceiver: aClass arguments: #().
((description accessor isKindOf: MANullAccessor)
and: [ description attributeName notNil ])
((description accessor isKindOf: SRNullAccessor)
and: [ description attributeName notNil ])
ifTrue: [ description accessor: (self buildDirectAccessorFor: description attributeName) ].

^description
@@ -1,5 +1,6 @@
private building
buildDirectAccessorFor: aString
^MAPluggableAccessor
read: [ :anObject | anObject instVarNamed: aString ]
write: [ :anObject :value | anObject instVarNamed: aString put: value ]

^ SRPluggableAccessor
read: [ :anObject | anObject readSlotNamed: aString ]
write: [ :anObject :value | anObject writeSlotNamed: aString value: value ]
@@ -1,6 +1,6 @@
{
"commentStamp" : "<historical>",
"super" : "MAPragmaBuilder",
"super" : "SRPragmaBuilder",
"category" : "Voyage-JSON-Magritte",
"classinstvars" : [ ],
"pools" : [ ],
Expand Down
2 changes: 1 addition & 1 deletion mc/Voyage-JSON.package/VOJSONFuture.class/properties.json
@@ -1,7 +1,7 @@
{
"commentStamp" : "EstebanLorenzano 6/13/2016 13:06",
"super" : "Object",
"category" : "Voyage-JSON",
"category" : "Voyage-JSON-Base",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
Expand Down
@@ -1,7 +1,7 @@
{
"commentStamp" : "EstebanLorenzano 6/14/2016 20:56",
"super" : "VOJSONVisitor",
"category" : "Voyage-JSON",
"category" : "Voyage-JSON-Base",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
Expand Down
@@ -1,7 +1,7 @@
{
"commentStamp" : "EstebanLorenzano 6/14/2016 20:56",
"super" : "VOJSONVisitor",
"category" : "Voyage-JSON",
"category" : "Voyage-JSON-Base",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
Expand Down
2 changes: 1 addition & 1 deletion mc/Voyage-JSON.package/VOJSONVisitor.class/properties.json
@@ -1,7 +1,7 @@
{
"commentStamp" : "<historical>",
"super" : "VOVisitor",
"category" : "Voyage-JSON",
"category" : "Voyage-JSON-Base",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
Expand Down
@@ -1,7 +1,7 @@
{
"commentStamp" : "<historical>",
"super" : "UndefinedObject",
"category" : "Voyage-JSON",
"category" : "Voyage-JSON-Base",
"classinstvars" : [ ],
"pools" : [ ],
"classvars" : [ ],
Expand Down
@@ -1,5 +1,6 @@
accessing
flush

self mutex critical: [
objects := WeakValueDictionary new.
reversedObjects := WeakKeyDictionary new.
Expand Down
@@ -1,4 +1,5 @@
initialization
initialize
initialize

super initialize.
self flush.
Expand Up @@ -9,5 +9,5 @@ performCompact
objects removeKey: each.
versions removeKey: each ].
objects compact.
reversedObjects finalizeValues; compact.
reversedObjects compact.
versions compact.
@@ -1,4 +1,5 @@
initialization
initialize

super initialize.
self initializeCache.
self initializeCache
@@ -1,3 +1,4 @@
initialization
initializeCache

cache := VOCache new.
@@ -1,6 +1,6 @@
{
"commentStamp" : "",
"super" : "MAVisitor",
"super" : "SRVisitor",
"category" : "Voyage-Model-Core-Base",
"classinstvars" : [ ],
"pools" : [ ],
Expand Down
Expand Up @@ -6,10 +6,10 @@ testAt
object := Object new.
cache at: 42 put: object.

self assert: (cache at: 42) = object.
self assert: (cache keyAtValue: object) = 42.
self assert: (cache at: 42) equals: object.
self assert: (cache keyAtValue: object) equals: 42.

object := nil.
Smalltalk garbageCollect.
3 timesRepeat: [ Smalltalk garbageCollect ].

self assert: (cache at: 42 ifAbsent: [ nil ]) isNil
self assert: (cache at: 42 ifAbsent: [ nil ]) isNil
Expand Up @@ -11,7 +11,7 @@ testKeyAtValue
self assert: (cache keyAtValue: object) = 42.

object := nil.
Smalltalk garbageCollect.
3 timesRepeat: [ Smalltalk garbageCollect ].

self assert: (cache at: 42 ifAbsent: [ nil ]) isNil.
cache performCompact.
Expand Down
Expand Up @@ -2,14 +2,14 @@ voyage
descriptionCreationDate
<voyageDescriptionPlatforms: #(unqlite arango ejdb)>

^VOToOneDescription new
^ VOToOneDescription new
attributeName: 'creationDate';
accessor: (MAPluggableAccessor
accessor: (SRPluggableAccessor
read: [ :pilot | pilot creationDate asString ]
write: [ :pilot :value |
value ifNotNil: [
pilot
instVarNamed: 'creationDate'
put: (DateAndTime fromString: value) ] ]);
writeSlotNamed: 'creationDate'
value: (DateAndTime fromString: value) ] ]);
beLazy;
yourself
Expand Up @@ -7,6 +7,6 @@ basicSelectOne
commandFind: where asMongoQuery
limit: 0
readConcern: nil)
setFlagSlaveOk;
"setFlagSlaveOk;"
do: [ :found | ^ found ].
^ nil ]
@@ -1,3 +1,4 @@
finalization
finalize

self stopSDAMClient
@@ -1,6 +1,11 @@
initialization
initialize

super initialize.

"register for finalization"
WeakRegistry default add: self.

insertConcerns := SmallDictionary new.
removeConcerns := SmallDictionary new.
updateConcerns := SmallDictionary new.
@@ -1,8 +1,10 @@
initialization
initializeMongoUrls: aCollection database: databaseString username: aUserName password: aPassword

databaseName := databaseString.
username := aUserName.
password := aPassword.

self initialize.

self ensuringCurrentOnSave: false.
Expand All @@ -15,4 +17,4 @@ initializeMongoUrls: aCollection database: databaseString username: aUserName pa
maxConnections: self poolSize;
connectTimeout: self connectionTimeout;
socketTimeout: self connectionTimeout.
sdamClient start.
sdamClient start
@@ -1,3 +1,4 @@
finalization
stopSDAMClient

sdamClient ifNotNil: #stop
Expand Up @@ -8,4 +8,4 @@ basicSelect
limit: limit
offset: offset
order: (sortBlock ifNil: [ #() ])
flags: QueryOperation flagSlaveOk ]
flags: 0 ]

0 comments on commit a47d48b

Please sign in to comment.