Skip to content

Commit 4141a40

Browse files
sebastianconceptSebastian Sastre
andauthored
Release support for SQLite and Pharo 10 and 11 (#142)
* 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]>
1 parent 1cf52e5 commit 4141a40

27 files changed

+1904
-123
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name: Unit Tests
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on: [push]
44

55
jobs:
66
unit-tests:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
smalltalk: [Pharo64-7.0]
10+
smalltalk: [Pharo64-10, Pharo64-11]
1111
redis-version: [7]
1212
mongodb-version: ['4.4']
1313
name: ${{ matrix.smalltalk }}

README.md

Lines changed: 54 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
1-
![Mapless](./header.png)
1+
![Mapless](./hero.jpg)
22

33
# Mapless
44

55
Schema-less persistence for Smalltalk with support for multiple backends.
66

7+
[![Release](https://img.shields.io/github/v/tag/sebastianconcept/Mapless?label=release)](https://github.com/sebastianconcept/Mapless/releases)
78
[![Unit Tests](https://github.com/sebastianconcept/Mapless/actions/workflows/build.yml/badge.svg)](https://github.com/sebastianconcept/Mapless/actions/workflows/build.yml)
9+
810
![Tests](https://img.shields.io/badge/tests-193-green)
911
[![Coverage Status](https://codecov.io/github/sebastianconcept/Mapless/coverage.svg?branch=main)](https://codecov.io/gh/sebastianconcept/Mapless/branch/master)
1012

11-
[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE.txt)
12-
[![Release](https://img.shields.io/github/v/tag/sebastianconcept/Mapless?label=release)](https://github.com/sebastianconcept/Mapless/releases)
1313

14-
15-
[![Pharo 7](https://img.shields.io/badge/Pharo-7-%23383932.svg)](https://pharo.org/download)
1614
[![Pharo 10](https://img.shields.io/badge/Pharo-10-%23383932.svg)](https://pharo.org/download)
15+
[![Pharo 11](https://img.shields.io/badge/Pharo-11-%23383932.svg)](https://pharo.org/download)
1716

1817
[![Social](https://img.shields.io/github/stars/sebastianconcept/Mapless?style=social)]()
1918
[![Forks](https://img.shields.io/github/forks/sebastianconcept/Mapless?style=sociall)]()
19+
[![License](https://img.shields.io/badge/license-MIT-green)](./LICENSE.txt)
2020

21+
### [Mapless GitHub Page](https://sebastianconcept.github.io/Mapless/)
2122
---
2223

24+
## Description
25+
26+
Mapless is a schema-less persistence framework supporting multiple backends and offering a user-friendly API. Querying Mapless objects involves a common family of methods, and there's no need to declare accessors and mutators. See [examples below](#examples).
27+
28+
Designed to eliminate the need for schema maintenance, Mapless avoids any Object-Relational Mapping requirements.
29+
30+
Mapless achieves a balance between maximum data survivability and robust architectural flexibility without imposing a heavy burden in terms of adoption and maintenance. A sweet spot for development and production.
31+
2332
## Features
2433

2534
- Intuitive API for frictionless persistence.
@@ -31,30 +40,36 @@ Schema-less persistence for Smalltalk with support for multiple backends.
3140
- Enables smooth data migration/interoperation among backends.
3241
- ~~Via Redis PUB/SUB, scalable observer-pattern functionality across images.~~ In the roadmap.
3342

34-
## Description
35-
36-
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).
37-
38-
Designed to be schema-less, Mapless eliminates the need for schema maintenance and avoids any Object-Relational Mapping requirements.
39-
40-
Mapless achieves a balance of maximum data survivability and robust architectural flexibility without imposing a heavy burden in terms of adoption and maintenance.
41-
42-
## Ambition
43-
44-
To deliver a high-performance solution that preserves arbitrary application state (data) with a focus on flexibility, availability, and capacity. It aims to strategically aid in scaling without causing backend vendor lock-in, across various persistence backends, and by neutralizing the costs associated with object-mapping impedance mismatch.
45-
4643
## Supported backends
4744

48-
1. MongoDB
49-
2. Redis
50-
3. Memory
51-
4. PostgreSQL
52-
5. ~~UnQLite~~ `deprecated` / retiring soon
45+
1. SQLite
46+
2. PostgreSQL
47+
3. Redis
48+
4. MongoDB
49+
5. Memory
50+
6. ~~UnQLite~~ `deprecated` / retiring soon
5351

5452
## Examples
53+
Try Mapless by [installing it in a supported Pharo image](#how-to-install) and the following snippets:
54+
55+
```Smalltalk
56+
"Instantiates an SQLite Mapless repository."
57+
repository := MaplessSQLiteRepository
58+
for: 'TryMapless'
59+
on: 'path/string/to/your/sqlite.db'.
60+
```
5561

5662
```Smalltalk
57-
"Instanciates a mapless object."
63+
"Custom class to model your data"
64+
Mapless subclass: #Person
65+
instanceVariableNames: ''
66+
classVariableNames: ''
67+
package: 'YourApp-Mapless'
68+
69+
"Guarantees the database has a Person table (this is idempotent)."
70+
repository ensureTableFor: #Person.
71+
72+
"Instantiates a Mapless object."
5873
philosopher := Person new
5974
firstName: 'Aristotle';
6075
yourself.
@@ -75,47 +90,54 @@ allOrEmpty := repository findAll: Person.
7590

7691
```Smalltalk
7792
"Query to load all the instances that match the condition."
78-
someOrEmpty := repository findAll: Person where: [ :each | each lastName = 'Peterson' ].
93+
someOrEmpty := repository findAll: Person where: [ :each |
94+
each firstName = 'Aristotle' ].
7995
```
8096

8197
```Smalltalk
8298
"Conditionally loading the first matching instance."
83-
oneOrNil := repository findOne: Person where: [ :each | each lastName = 'Peterson' ].
99+
oneOrNil := repository findOne: Person where: [ :each |
100+
each firstName = 'Aristotle' ].
84101
```
85102

86103
```Smalltalk
87-
"Create a Person mapless model"
104+
"Create a Person Mapless model"
88105
philosopher := Person new
89106
firstName: 'Aristotle';
90107
save.
91108
92-
"Set it as the person for a new User mapless model"
109+
"Set it as the person for a new User Mapless model"
93110
philosopherUser := User new
94111
person: philosopher;
95112
save.
96113
97114
"Query for that user by ID and get its person instance"
98115
aristotle := (User findId: philosopherUser id) person.
99116
```
100-
## Installation
117+
## How to Install
101118

102-
Open a workspace in a supported Pharo image and evaluate:
119+
To start with Mapless, download Pharo, open a Pharo Playground and evaluate:
103120

104121
```smalltalk
105122
Metacello new
106123
baseline: 'Mapless';
107124
repository: 'github://sebastianconcept/Mapless:latest/src';
108-
load
125+
load.
126+
127+
"By default, Mapless loads the Memory and SQLite backends"
109128
```
110129

111130
## Include as dependency
112131

113-
In BaselineOf or ConfigurationOf it can be added in this way:
132+
To include Mapless as a dependency from `BaselineOf` or `ConfigurationOf` add it with:
114133

115134
```smalltalk
116135
spec
117136
baseline: 'Mapless'
118137
with: [ spec
119138
repository: 'github://sebastianconcept/Mapless:latest/src';
120-
load: #('Core' 'Postgres' 'Mongo' 'Redis' 'Memory') ]
139+
load: #('Core' 'SQLite' 'Postgres' 'Mongo' 'Redis' 'Memory') ]
121140
```
141+
## Project Ambition
142+
143+
To deliver a high-performance solution that preserves arbitrary application state (data) with a focus on flexibility, availability, and capacity. It aims to strategically aid in scaling without causing vendor lock-in, across various persistence backends, and by neutralizing the costs associated with object-mapping impedance mismatch.

changelog.md

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,49 @@
1+
Jan 30, 2024 | v0.6.0 | Sharp Bird
2+
===================================
3+
* Version relese
4+
5+
Jan 29, 2024
6+
===================================
7+
* Added SQLite support.
8+
* Added Pharo 10 and Pharo 11 support.
9+
* Dropped Pharo 7 support. Last working version on Pharo 7 was v0.5.26
10+
* Added badges to the README.md
11+
112
Jan 25, 2024
213
===================================
3-
- Updating `master` branch to keep up with the latests useful upgrades.
4-
- Adding badges to the README.md for constant monitoring of CI, unit tests, regression detection capacity and supported Pharo versions.
5-
- Adds CI via GitHub actions.
14+
* Updating `master` branch to keep up with the latests useful upgrades.
15+
* Adding badges to the README.md for constant monitoring of CI, unit tests, regression detection capacity and supported Pharo versions.
16+
* Adds CI via GitHub actions.
17+
18+
October 10, 2023
19+
===================================
20+
* Fixed most tests for the SQLite backend.
21+
* Adjusted Benchmarking clases and added the one for SQLite.
622

723
May 22, 2023
824
===================================
9-
- Improved `MongoAPI` by adding `initializeMongoUrl` and a lazy accessor using it and `Array` instead of `Set` so comparing it on the fly from `getIdleReadOnlyClient` is significantly faster now.
10-
- `MaplessWeightedRandomPolicy>>nextAmong:` is faster now by not using `includes:` and use a `anySatisfy:` filter instead.
25+
* Improved `MongoAPI` by adding `initializeMongoUrl` and a lazy accessor using it and `Array` instead of `Set` so comparing it on the fly from `getIdleReadOnlyClient` is significantly faster now.
26+
* `MaplessWeightedRandomPolicy>>nextAmong:` is faster now by not using `includes:` and use a `anySatisfy:` filter instead.
1127

1228
May 19, 2023
1329
===================================
14-
- Added `defaultMinClients` for `MaplessStandaloneMongoPool`.
30+
* Added `defaultMinClients` for `MaplessStandaloneMongoPool`.
1531

1632
May 19, 2022 | v0.5.4-beta | Humble Falcon
1733
===================================
18-
- `MongoChange` is now using MongoDB `document` instead of `jsonish`.
19-
- Version bump.
34+
* `MongoChange` is now using MongoDB `document` instead of `jsonish`.
35+
* Version bump.
2036

2137
May 18, 2022 | v0.5.3-beta | Proud Falcon
2238
===================================
23-
- Declaring stable API for beta version.
39+
* Declaring stable API for beta version.
2440

2541
May 18, 2022 | v0.5.2-alpha | Major Bird
2642
===================================
27-
- `MongoChange` `type` is now uppercase for client convenience.
28-
- Added `maplessClass` accessor in `Mapless` and `MaplessReference`.
29-
- Added `unobservable` accessor to prevent recursive changes log.
30-
- Fixes `DELETE` missing jsonish in the `MongoChange` object.
43+
* `MongoChange` `type` is now uppercase for client convenience.
44+
* Added `maplessClass` accessor in `Mapless` and `MaplessReference`.
45+
* Added `unobservable` accessor to prevent recursive changes log.
46+
* Fixes `DELETE` missing jsonish in the `MongoChange` object.
3147

3248
May 11, 2022 | v0.5.1-alpha | Tense Eagle
3349
===================================

hero.jpg

79.7 KB
Loading

src/BaselineOfMapless/BaselineOfMapless.class.st

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ BaselineOfMapless >> baseline: spec [
3535
group: 'Mongo' with: #('Mapless-Mongo-Tests');
3636
group: 'Redis' with: #('Mapless-Redis-Tests');
3737
group: 'Postgres' with: #('Mapless-Postgres-Tests');
38+
group: 'SQLite' with: #('Mapless-SQLite-Tests');
3839
group: 'UnQLite' with: #('Mapless-UnQLite-Tests');
3940
group: 'Benchmark' with: #('Mapless-Benchmark-Core');
40-
group: 'default' with: #('Memory' 'Mongo') ]
41+
group: 'default' with: #('Memory' 'SQLite') ]
4142
]
4243

4344
{ #category : #baseline }
@@ -69,9 +70,11 @@ BaselineOfMapless >> setUpBasePackages: spec [
6970

7071
{ #category : #baseline }
7172
BaselineOfMapless >> setUpMongoDependencies: spec [
72-
spec
73-
baseline: 'MongoTalk'
74-
with: [ spec repository: 'github://pharo-nosql/mongotalk:1.25/mc' ]
73+
74+
spec baseline: 'MongoTalk' with: [
75+
spec
76+
repository: 'github://pharo-nosql/mongotalk:v2.0/mc';
77+
loads: #( Client 'Mongo-DriverLegacy' ) ]
7578
]
7679

7780
{ #category : #baseline }
@@ -104,6 +107,9 @@ BaselineOfMapless >> setUpPackages: spec [
104107
self setUpPostgresDependencies: spec.
105108
self setUpPostgresPackages: spec.
106109

110+
self setUpSQLiteDependencies: spec.
111+
self setUpSQLitePackages: spec.
112+
107113
self setUpUnQLiteDependencies: spec.
108114
self setUpUnQLitePackages: spec
109115
]
@@ -142,6 +148,25 @@ BaselineOfMapless >> setUpRedisPackages: spec [
142148
with: [ spec requires: #('Mapless-Redis-Core' 'Mapless-Tests-Base') ]
143149
]
144150

151+
{ #category : #baseline }
152+
BaselineOfMapless >> setUpSQLiteDependencies: spec [
153+
spec
154+
baseline: 'SQLite3'
155+
with: [ spec
156+
repository: 'github://pharo-rdbms/Pharo-SQLite3/src';
157+
loads: #('Core') ]
158+
]
159+
160+
{ #category : #baseline }
161+
BaselineOfMapless >> setUpSQLitePackages: spec [
162+
spec
163+
package: 'Mapless-SQLite-Core'
164+
with: [ spec requires: #('Mapless-Base-Core' 'SQLite3') ].
165+
spec
166+
package: 'Mapless-SQLite-Tests'
167+
with: [ spec requires: #('Mapless-SQLite-Core' 'Mapless-Tests-Base') ]
168+
]
169+
145170
{ #category : #baseline }
146171
BaselineOfMapless >> setUpUnQLiteDependencies: spec [
147172
spec

src/Mapless-Base-Core/MaplessAbstractPool.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ MaplessAbstractPool class >> local [
3939
]
4040

4141
{ #category : #accessing }
42-
MaplessAbstractPool >> currentClientDynamicVariable [
42+
MaplessAbstractPool >> currentClientDynamicVariableClass [
4343
"Answers the class of the dynamic variable that will
4444
hold the value of the current client during the evaluation of its usage."
4545

src/Mapless-Base-Core/MaplessError.class.st

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
"
2+
I'm the type of Error specific to Mapless scenarios
3+
"
14
Class {
25
#name : #MaplessError,
36
#superclass : #Error,

src/Mapless-Benchmark-Core/MaplessRedisBenchmark.class.st

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
"
2-
This class provides some basic performance test for Mapless on MongoDB.
2+
This class provides some basic performance test for Mapless on Redis.
33
44
Convenience to run it logging to the Transcript:
55
6-
MaplessMongoBenchmark run
6+
MaplessRedisBenchmark run
77
88
Convenience to run it logging to SomeLogFile.log:
99
1010
'SomeLogFile.log' asFileReference writeStreamDo: [ :stream |
11-
MaplessMongoBenchmark runPrintingOn: stream ]
11+
MaplessRedisBenchmark runPrintingOn: stream ]
1212
"
1313
Class {
1414
#name : #MaplessRedisBenchmark,

0 commit comments

Comments
 (0)