-
Notifications
You must be signed in to change notification settings - Fork 321
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[omm] Hash api implementation first draft (#1355)
- Loading branch information
Showing
7 changed files
with
145 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
||
""" | ||
Accessors for various "global" resources, usually cached by request lifetime | ||
I can't tell if these should just be in app.py, so I'm sticking it here for now, | ||
since one advantage of putting these in functions is we can type the output. | ||
""" | ||
|
||
from flask import g | ||
|
||
from OpenMediaMatch.storage.interface import IUnifiedStore | ||
from OpenMediaMatch.storage.default import DefaultOMMStore | ||
|
||
|
||
def get_storage() -> IUnifiedStore: | ||
""" | ||
Get the storage object, which is just a wrapper around the real storage. | ||
""" | ||
if "storage" not in g: | ||
# dougneal, you'll need to eventually add constructor arguments | ||
# for this to pass in the postgres/database object. We're just | ||
# hiding flask bits from pytx bits | ||
g.storage = DefaultOMMStore() | ||
return g.storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters