Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

93 support for SQLite #141

Merged
merged 40 commits into from
Jan 30, 2024
Merged

93 support for SQLite #141

merged 40 commits into from
Jan 30, 2024

Conversation

sebastianconcept
Copy link
Owner

@sebastianconcept sebastianconcept commented Jan 29, 2024

This PR update Mapless so it can be used in Pharo 11 and Pharo 10 making sure the CI is happy and coverage/regression detection is preserved.

As the changelog says:

Jan 29, 2024
===================================
* Added SQLite support.
* Added Pharo 10 and Pharo 11 support.
* Dropped Pharo 7 support. Last working version on Pharo 7 was v0.5.26
* Added badges to the README.md

Also reviewed the readme so more people can try it and get started.

Copy link

codecov bot commented Jan 29, 2024

Codecov Report

Attention: 7 lines in your changes are missing coverage. Please review.

Comparison is base (6b65116) 56.67% compared to head (06d1585) 57.70%.

Files Patch % Lines
...pless-Memory-Core/MaplessMemoryRepository.class.st 90.69% 4 Missing ⚠️
...ess-Mongo-Core/MaplessMongoReplicaSetPool.class.st 0.00% 3 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #141      +/-   ##
===========================================
+ Coverage    56.67%   57.70%   +1.02%     
===========================================
  Files           31       31              
  Lines         4157     4161       +4     
===========================================
+ Hits          2356     2401      +45     
+ Misses        1801     1760      -41     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sebastianconcept sebastianconcept self-assigned this Jan 29, 2024
@sebastianconcept sebastianconcept added enhancement New Functionality chore A maintenance or marginal improvement task labels Jan 29, 2024
@paulwilke paulwilke closed this Jan 30, 2024
@paulwilke
Copy link
Collaborator

Stupid me I closed it

@paulwilke paulwilke reopened this Jan 30, 2024
@sebastianconcept
Copy link
Owner Author

@paulwilke careful padawan, the vergence in the force is so strong with you that GitHub buttons get clicked if you do not control the dark side well enough.

Copy link
Collaborator

@fgarau fgarau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all minor points commented in place

README.md Outdated
---

## Description

Mapless is a schema-less persistence framework supporting multiple backends and offering a user-friendly API. For instance, querying Mapless objects involves a common family of methods, and there's no need to declare accessors and mutators. See [examples below](#examples).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Escribir es borrar -- siempre decia Leandro Caniglia
En la segunda linea podes sacar el "For instance," y se lee mejor.

README.md Outdated

Mapless is a schema-less persistence framework supporting multiple backends and offering a user-friendly API. For instance, querying Mapless objects involves a common family of methods, and there's no need to declare accessors and mutators. See [examples below](#examples).

Designed to be schema-less, Mapless eliminates the need for schema maintenance and avoids any Object-Relational Mapping requirements.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tambien eliminaria el "Designed to be schema-less," -- ya lo dijiste en el parrafo anterior

README.md Outdated
philosopherUser := User new
person: philosopher;
save.

"Query for that user by ID and get its person instance"
aristotle := (User findId: philosopherUser id) person.
```
## Installation
## Install
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmhh "How to Install" o "Installation" me suenan mejor, no se.

@@ -1,25 +1,34 @@
![Mapless](./header.png)
![Mapless](./hero.jpg)

# Mapless

Schema-less persistence for Smalltalk with support for multiple backends.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Me gusto el tag de la imagen "Obsenly simple object persistence" -- schema-less and offering support for multiple backends

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fgarau no te había preguntado pero justo estaba hablando sobre la tagline con @eMaringolo hace un ratito :)


spec baseline: 'MongoTalk' with: [
spec
repository: 'github://pharo-nosql/mongotalk:v2.0/mc';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To discuss why a specific version is needed here (v2.0)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fgarau as Mapless is used in production, all its dependencies need to be version pinned. Actually you reminded me we can pin a couple more! Thanks for commenting about it.

PS: MongoTalk 2.0 is needed for accessing MongoDB from Pharo 10 and 10

id := sqliteRow first.
maplessData := Json readFrom: sqliteRow values second readStream.
maplessData at: aMaplessRepository idPropertyName put: id.
^ Mapless fromJSONObject: maplessData in: aMaplessRepository
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just wondering where the readStream would be closed.
if the readStream is on a String, then ignore the above comment.

Copy link
Owner Author

@sebastianconcept sebastianconcept Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fgarau yes, the Json readFrom: is the only user of that stream

^ String
streamContents: [ :stream |
stream
<<
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure where the << is implemented -- looks a bit confusing to me

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fgarau it's a Pharo way to say nextPutAll: :)
Screen Shot 2024-01-30 at 15 32 22

]

{ #category : #accessing }
MaplessSQLitePool >> currentClientDynamicVariable [
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmh.. wouldn't it be better currentClientDynamicVariableClass

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fgarau yes it would! great catch

nextPutAll:
'(' , self busyClients size asString , ' busy, '
, self idleClients size asString , ' idle @'
, databaseFilenameOrKeyword , ')'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since you have a stream, I would rather avoid concatenation and use cascading nextPutAll: messages

"Removes any client that might be expired or unreacheable."

self busyClients copy do: [ :e | self ifUnavailablePurge: e ].
self idleClients copy do: [ :e | self ifUnavailablePurge: e ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why copying the collection when you operate on the elements?
would this work?
(self busyClients , self idleClients) do: [:e | self ifUnavailablePurge: e].

Copy link
Owner Author

@sebastianconcept sebastianconcept Jan 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fgarau because ifUnavailablePurge: mutates the collection and you should never mutate a collection while iterating it?

@sebastianconcept
Copy link
Owner Author

Screen Shot 2024-01-30 at 16 37 36

Lovely

@sebastianconcept sebastianconcept merged commit 57ae861 into develop Jan 30, 2024
4 checks passed
sebastianconcept added a commit that referenced this pull request Jan 30, 2024
* 93 support for SQLite (#141)

* Adjusts the baseline

* WIP for testSimple

* Comment improvment

* testSimpleSave green

* fixed more tests

* fixes benchmark for sqlite

* makes unqlite benchmarks work and using JSON for serialization

* changelog entry

* fixes findAll:

* fixes SQLite dependency in the baseline

* fixes escaping single quote for insert and update, removes obsolete code and also fixes 2 unrelated unit tests

* removes unused code and adds class comments

* working well with SQLite ^3.38

* adds testTruncate

* adds truncateAll

* adds databaseStartOn: double dispatching with sqlLiteDatabaseStart

* updates method for Pharo 10 to run tests

* upgrades MongoTalk

* adds Pharo64-10 and drops Pharo 7

* milliseconds to milliSeconds

* updates changelog, readme and CI

* adds missing ,

* wider range of acceptance for the tests of the replica set load balancer

* adjust unit test from Pharo 11

* Run CI only on push

* remove unused method and poorly worded comments

* covering #drop

* covers existence detection

* removes unused method

* covers insert:

* adds coverage to findAll: aMaplessClass where: someConditions limit: aLimitOrNil sort:

* readme edit

* instance creation convenience

* readme edit

* baseline default now is to load Memory and SQLite backends

* readme edit

* readme edit

* renames currentClientDynamicVariable to currentClientDynamicVariableClass

---------

Co-authored-by: Sebastian Sastre <[email protected]>

* changelog edit

---------

Co-authored-by: Sebastian Sastre <[email protected]>
@sebastianconcept sebastianconcept deleted the 93-Support-for-SQLite branch January 30, 2024 20:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore A maintenance or marginal improvement task enhancement New Functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants