Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
8863624f
Commit
8863624f
authored
5 years ago
by
Erik Johnston
Browse files
Options
Downloads
Patches
Plain Diff
Comments
parent
756d4942
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
synapse/storage/__init__.py
+4
-4
4 additions, 4 deletions
synapse/storage/__init__.py
synapse/storage/_base.py
+7
-1
7 additions, 1 deletion
synapse/storage/_base.py
synapse/storage/database.py
+5
-0
5 additions, 0 deletions
synapse/storage/database.py
with
16 additions
and
5 deletions
synapse/storage/__init__.py
+
4
−
4
View file @
8863624f
...
...
@@ -17,10 +17,10 @@
"""
The storage layer is split up into multiple parts to allow Synapse to run
against different configurations of databases (e.g. single or multiple
databases). The `
d
ata
_stores` are classes that talk directly to a singl
e
data
base and have associated schemas, background updates, etc. On top of thos
e
there are (or will be) classes that provide high level interfaces that combine
calls to multiple `data_stores`.
databases). The `
D
ata
base` class represents a single physical database. Th
e
`
data
_stores` are classes that talk directly to a `Database` instance and hav
e
associated schemas, background updates, etc. On top of those there are classes
that provide high level interfaces that combine
calls to multiple `data_stores`.
There are also schemas that get applied to every database, regardless of the
data stores associated with them (e.g. the schema version tables), which are
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/_base.py
+
7
−
1
View file @
8863624f
...
...
@@ -31,11 +31,17 @@ logger = logging.getLogger(__name__)
class
SQLBaseStore
(
object
):
"""
Base class for data stores that holds helper functions.
Note that multiple instances of this class will exist as there will be one
per data store (and not one per physical database).
"""
def
__init__
(
self
,
db_conn
,
hs
):
self
.
hs
=
hs
self
.
_clock
=
hs
.
get_clock
()
self
.
database_engine
=
hs
.
database_engine
self
.
db
=
Database
(
hs
)
self
.
db
=
Database
(
hs
)
# In future this will be passed in
self
.
rand
=
random
.
SystemRandom
()
def
_invalidate_state_caches
(
self
,
room_id
,
members_changed
):
...
...
This diff is collapsed.
Click to expand it.
synapse/storage/database.py
+
5
−
0
View file @
8863624f
...
...
@@ -211,6 +211,11 @@ class PerformanceCounters(object):
class
Database
(
object
):
"""
Wraps a single physical database and connection pool.
A single database may be used by multiple data stores.
"""
_TXN_ID
=
0
def
__init__
(
self
,
hs
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment