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
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1431f33
Adjusts the baseline
Apr 15, 2022
7183396
WIP for testSimple
Apr 16, 2022
7867dd3
Comment improvment
Apr 16, 2022
5a27326
testSimpleSave green
Apr 18, 2022
851b5d0
fixed more tests
sebastianconcept Oct 10, 2023
f391cab
fixes benchmark for sqlite
sebastianconcept Oct 10, 2023
7eaa6a8
makes unqlite benchmarks work and using JSON for serialization
sebastianconcept Oct 10, 2023
1377b0d
changelog entry
sebastianconcept Oct 10, 2023
06f8dc6
fixes findAll:
sebastianconcept Oct 10, 2023
b5a3dce
fixes SQLite dependency in the baseline
sebastianconcept Oct 11, 2023
6909709
fixes escaping single quote for insert and update, removes obsolete c…
sebastianconcept Nov 19, 2023
74e3186
removes unused code and adds class comments
sebastianconcept Oct 28, 2023
ef28a4a
working well with SQLite ^3.38
sebastianconcept Oct 28, 2023
72706ee
adds testTruncate
sebastianconcept Dec 23, 2023
5ac8404
adds truncateAll
sebastianconcept Dec 23, 2023
d1c2515
adds databaseStartOn: double dispatching with sqlLiteDatabaseStart
sebastianconcept Dec 26, 2023
2441876
updates method for Pharo 10 to run tests
sebastianconcept Jan 29, 2024
c21dd99
upgrades MongoTalk
sebastianconcept Jan 29, 2024
cc6e2b6
adds Pharo64-10 and drops Pharo 7
sebastianconcept Jan 29, 2024
3b678b2
milliseconds to milliSeconds
sebastianconcept Jan 29, 2024
7b2e417
updates changelog, readme and CI
sebastianconcept Jan 29, 2024
2e4b985
adds missing ,
sebastianconcept Jan 29, 2024
c12c5db
wider range of acceptance for the tests of the replica set load balancer
sebastianconcept Jan 29, 2024
34d9b01
Merge 2e4b98506f48f393571d8f605c13ad2b56ab4159
sebastianconcept Jan 29, 2024
c1665b4
adjust unit test from Pharo 11
sebastianconcept Jan 29, 2024
270fd5d
Run CI only on push
sebastianconcept Jan 29, 2024
8b79ca3
remove unused method and poorly worded comments
sebastianconcept Jan 29, 2024
a203cc5
Merge 270fd5d5a34eaef1d2baeef7947ee7b900838888
sebastianconcept Jan 29, 2024
1ab67e9
covering #drop
sebastianconcept Jan 29, 2024
7d842cb
covers existence detection
sebastianconcept Jan 29, 2024
cb7bbbf
removes unused method
sebastianconcept Jan 29, 2024
c6a54ba
covers insert:
sebastianconcept Jan 29, 2024
f138928
adds coverage to findAll: aMaplessClass where: someConditions limit: …
sebastianconcept Jan 29, 2024
9ed4ee9
readme edit
sebastianconcept Jan 29, 2024
90aa096
instance creation convenience
sebastianconcept Jan 29, 2024
0f75590
readme edit
sebastianconcept Jan 29, 2024
3c9eeeb
baseline default now is to load Memory and SQLite backends
sebastianconcept Jan 29, 2024
8dfa0f8
readme edit
sebastianconcept Jan 30, 2024
8523bcf
readme edit
sebastianconcept Jan 30, 2024
06d1585
renames currentClientDynamicVariable to currentClientDynamicVariableC…
sebastianconcept Jan 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
name: Unit Tests

on: [push, pull_request, workflow_dispatch]
on: [push]

jobs:
unit-tests:
runs-on: ubuntu-latest
strategy:
matrix:
smalltalk: [Pharo64-7.0]
smalltalk: [Pharo64-10, Pharo64-11]
redis-version: [7]
mongodb-version: ['4.4']
name: ${{ matrix.smalltalk }}
Expand Down
77 changes: 47 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -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 :)

[![Release](https://img.shields.io/github/v/tag/sebastianconcept/Mapless?label=release)](https://github.com/sebastianconcept/Mapless/releases)
[![Unit Tests](https://github.com/sebastianconcept/Mapless/actions/workflows/build.yml/badge.svg)](https://github.com/sebastianconcept/Mapless/actions/workflows/build.yml)

![Tests](https://img.shields.io/badge/tests-193-green)
[![Coverage Status](https://codecov.io/github/sebastianconcept/Mapless/coverage.svg?branch=main)](https://codecov.io/gh/sebastianconcept/Mapless/branch/master)

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


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

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

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

## 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.

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

Mapless achieves a balance of maximum data survivability and robust architectural flexibility without imposing a heavy burden in terms of adoption and maintenance.

## Features

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

## 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).

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

Mapless achieves a balance of maximum data survivability and robust architectural flexibility without imposing a heavy burden in terms of adoption and maintenance.

## Ambition

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.

## Supported backends

1. MongoDB
2. Redis
3. Memory
4. PostgreSQL
5. ~~UnQLite~~ `deprecated` / retiring soon
1. SQLite
2. PostgreSQL
3. Redis
4. MongoDB
5. Memory
6. ~~UnQLite~~ `deprecated` / retiring soon

## Examples
Try Mapless by [installing it in a supported Pharo image](#install) and the following snippets:

```Smalltalk
"Instanciates a mapless object."
"Instantiates an SQLite Mapless repository."
repository := MaplessSQLiteRepository
for: 'TryMapless'
on: 'path/string/to/your/sqlite.db'.
```

```Smalltalk
"Custom class to model your data"
Mapless subclass: #Person
instanceVariableNames: ''
classVariableNames: ''
package: 'YourApp-Mapless'

"Instantiates a Mapless object."
philosopher := Person new
firstName: 'Aristotle';
yourself.
Expand All @@ -75,31 +87,33 @@ allOrEmpty := repository findAll: Person.

```Smalltalk
"Query to load all the instances that match the condition."
someOrEmpty := repository findAll: Person where: [ :each | each lastName = 'Peterson' ].
someOrEmpty := repository findAll: Person where: [ :each |
each firstName = 'Aristotle' ].
```

```Smalltalk
"Conditionally loading the first matching instance."
oneOrNil := repository findOne: Person where: [ :each | each lastName = 'Peterson' ].
oneOrNil := repository findOne: Person where: [ :each |
each firstName = 'Aristotle' ].
```

```Smalltalk
"Create a Person mapless model"
"Create a Person Mapless model"
philosopher := Person new
firstName: 'Aristotle';
save.

"Set it as the person for a new User mapless model"
"Set it as the person for a new User Mapless model"
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.

Open a workspace in a supported Pharo image and evaluate:
To start with Mapless, download Pharo, open a Pharo Playground and evaluate:

```smalltalk
Metacello new
Expand All @@ -110,7 +124,7 @@ Metacello new

## Include as dependency

In BaselineOf or ConfigurationOf it can be added in this way:
To include Mapless as a dependency from BaselineOf or ConfigurationOf add it with:

```smalltalk
spec
Expand All @@ -119,3 +133,6 @@ spec
repository: 'github://sebastianconcept/Mapless:latest/src';
load: #('Core' 'Postgres' 'Mongo' 'Redis' 'Memory') ]
```
## Project Ambition

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.
38 changes: 25 additions & 13 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,45 @@
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

Jan 25, 2024
===================================
- Updating `master` branch to keep up with the latests useful upgrades.
- Adding badges to the README.md for constant monitoring of CI, unit tests, regression detection capacity and supported Pharo versions.
- Adds CI via GitHub actions.
* Updating `master` branch to keep up with the latests useful upgrades.
* Adding badges to the README.md for constant monitoring of CI, unit tests, regression detection capacity and supported Pharo versions.
* Adds CI via GitHub actions.

October 10, 2023
===================================
* Fixed most tests for the SQLite backend.
* Adjusted Benchmarking clases and added the one for SQLite.

May 22, 2023
===================================
- 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.
- `MaplessWeightedRandomPolicy>>nextAmong:` is faster now by not using `includes:` and use a `anySatisfy:` filter instead.
* 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.
* `MaplessWeightedRandomPolicy>>nextAmong:` is faster now by not using `includes:` and use a `anySatisfy:` filter instead.

May 19, 2023
===================================
- Added `defaultMinClients` for `MaplessStandaloneMongoPool`.
* Added `defaultMinClients` for `MaplessStandaloneMongoPool`.

May 19, 2022 | v0.5.4-beta | Humble Falcon
===================================
- `MongoChange` is now using MongoDB `document` instead of `jsonish`.
- Version bump.
* `MongoChange` is now using MongoDB `document` instead of `jsonish`.
* Version bump.

May 18, 2022 | v0.5.3-beta | Proud Falcon
===================================
- Declaring stable API for beta version.
* Declaring stable API for beta version.

May 18, 2022 | v0.5.2-alpha | Major Bird
===================================
- `MongoChange` `type` is now uppercase for client convenience.
- Added `maplessClass` accessor in `Mapless` and `MaplessReference`.
- Added `unobservable` accessor to prevent recursive changes log.
- Fixes `DELETE` missing jsonish in the `MongoChange` object.
* `MongoChange` `type` is now uppercase for client convenience.
* Added `maplessClass` accessor in `Mapless` and `MaplessReference`.
* Added `unobservable` accessor to prevent recursive changes log.
* Fixes `DELETE` missing jsonish in the `MongoChange` object.

May 11, 2022 | v0.5.1-alpha | Tense Eagle
===================================
Expand Down
Binary file added hero.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 29 additions & 4 deletions src/BaselineOfMapless/BaselineOfMapless.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ BaselineOfMapless >> baseline: spec [
group: 'Mongo' with: #('Mapless-Mongo-Tests');
group: 'Redis' with: #('Mapless-Redis-Tests');
group: 'Postgres' with: #('Mapless-Postgres-Tests');
group: 'SQLite' with: #('Mapless-SQLite-Tests');
group: 'UnQLite' with: #('Mapless-UnQLite-Tests');
group: 'Benchmark' with: #('Mapless-Benchmark-Core');
group: 'default' with: #('Memory' 'Mongo') ]
group: 'default' with: #('Memory' 'SQLite') ]
]

{ #category : #baseline }
Expand Down Expand Up @@ -69,9 +70,11 @@ BaselineOfMapless >> setUpBasePackages: spec [

{ #category : #baseline }
BaselineOfMapless >> setUpMongoDependencies: spec [
spec
baseline: 'MongoTalk'
with: [ spec repository: 'github://pharo-nosql/mongotalk:1.25/mc' ]

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

loads: #( Client 'Mongo-DriverLegacy' ) ]
]

{ #category : #baseline }
Expand Down Expand Up @@ -104,6 +107,9 @@ BaselineOfMapless >> setUpPackages: spec [
self setUpPostgresDependencies: spec.
self setUpPostgresPackages: spec.

self setUpSQLiteDependencies: spec.
self setUpSQLitePackages: spec.

self setUpUnQLiteDependencies: spec.
self setUpUnQLitePackages: spec
]
Expand Down Expand Up @@ -142,6 +148,25 @@ BaselineOfMapless >> setUpRedisPackages: spec [
with: [ spec requires: #('Mapless-Redis-Core' 'Mapless-Tests-Base') ]
]

{ #category : #baseline }
BaselineOfMapless >> setUpSQLiteDependencies: spec [
spec
baseline: 'SQLite3'
with: [ spec
repository: 'github://pharo-rdbms/Pharo-SQLite3/src';
loads: #('Core') ]
]

{ #category : #baseline }
BaselineOfMapless >> setUpSQLitePackages: spec [
spec
package: 'Mapless-SQLite-Core'
with: [ spec requires: #('Mapless-Base-Core' 'SQLite3') ].
spec
package: 'Mapless-SQLite-Tests'
with: [ spec requires: #('Mapless-SQLite-Core' 'Mapless-Tests-Base') ]
]

{ #category : #baseline }
BaselineOfMapless >> setUpUnQLiteDependencies: spec [
spec
Expand Down
6 changes: 3 additions & 3 deletions src/Mapless-Benchmark-Core/MaplessRedisBenchmark.class.st
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
"
This class provides some basic performance test for Mapless on MongoDB.
This class provides some basic performance test for Mapless on Redis.

Convenience to run it logging to the Transcript:

MaplessMongoBenchmark run
MaplessRedisBenchmark run

Convenience to run it logging to SomeLogFile.log:

'SomeLogFile.log' asFileReference writeStreamDo: [ :stream |
MaplessMongoBenchmark runPrintingOn: stream ]
MaplessRedisBenchmark runPrintingOn: stream ]
"
Class {
#name : #MaplessRedisBenchmark,
Expand Down
Loading
Loading