-
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.
- Loading branch information
Showing
4 changed files
with
126 additions
and
1 deletion.
There are no files selected for viewing
Empty file.
36 changes: 36 additions & 0 deletions
36
open-media-match/src/OpenMediaMatch/background_tasks/fetcher.py
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,36 @@ | ||
# Copyright (c) Meta Platforms, Inc. and affiliates. | ||
|
||
import typing as t | ||
|
||
from OpenMediaMatch.storage.interface import ICollaborationStore, SignalType | ||
from threatexchange.exchanges.fetch_state import CollaborationConfigBase | ||
|
||
|
||
def fetch_all( | ||
collab_store: ICollaborationStore, | ||
enabled_signal_types: t.Dict[str, t.Type[SignalType]], | ||
) -> None: | ||
""" | ||
For all collaborations registered with OMM, fetch() | ||
""" | ||
collabs = collab_store.get_collaborations() | ||
for c in collabs.values(): | ||
fetch(collab_store, enabled_signal_types, c) | ||
|
||
|
||
def fetch( | ||
config: ICollaborationStore, | ||
enabled_signal_types: t.Dict[str, t.Type[SignalType]], | ||
collab: CollaborationConfigBase, | ||
): | ||
""" | ||
Fetch data from | ||
1. Attempt to authenticate with that collaboration's API | ||
using stored credentials. | ||
2. Load the fetch checkpoint from storage | ||
3. Resume the fetch at the checkpoint | ||
4. Download new data | ||
5. Send the new data to storage (saving the new checkpoint) | ||
""" | ||
# TODO |
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