This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
media_mpx.services.yml
176 lines (147 loc) · 6.8 KB
/
media_mpx.services.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
services:
# This is the service used to make authenticated requests to mpx.
media_mpx.authenticated_client_factory:
class: Drupal\media_mpx\AuthenticatedClientFactory
arguments: ['@media_mpx.client', '@media_mpx.user_session_factory']
media_mpx.data_object_factory_creator:
class: Drupal\media_mpx\DataObjectFactoryCreator
arguments: ['@media_mpx.data_service_manager', '@media_mpx.authenticated_client_factory', '@media_mpx.metadata_cache_pool_adapter']
media_mpx.data_service_manager:
class: Lullabot\Mpx\DataService\DataServiceManager
factory: ['Lullabot\Mpx\DataService\DataServiceManager', 'basicDiscovery']
arguments: ['@media_mpx.custom_field_manager']
media_mpx.user_session_factory:
class: Drupal\media_mpx\UserSessionFactory
arguments: ['@media_mpx.client', '@media_mpx.session_lock', '@media_mpx.token_cache_pool']
media_mpx.data_object_importer:
class: Drupal\media_mpx\DataObjectImporter
arguments: ['@entity_type.manager', '@event_dispatcher', '@cache.media_mpx_http']
media_mpx.notification_listener:
class: Drupal\media_mpx\NotificationListener
arguments: ['@media_mpx.authenticated_client_factory', '@media_mpx.data_service_manager', '@state', '@logger.channel.media_mpx']
logger.channel.media_mpx:
parent: logger.channel_base
arguments: ['media_mpx']
media_mpx.exception_logger:
class: Drupal\media_mpx\MpxLogger
arguments: ['@logger.channel.media_mpx']
# Discovers custom field classes in all enabled modules
media_mpx.custom_field_discovery:
class: Drupal\media_mpx\CustomFieldDiscovery
arguments: ['@container.namespaces']
media_mpx.custom_field_manager:
class: Lullabot\Mpx\DataService\CustomFieldManager
arguments: ['@media_mpx.custom_field_discovery']
# We need to define our own handler stack instance separate from Drupal
# core's. Otherwise, when we add the mpx_errors handler, it gets applied to
# all HTTP requests, and not just those sent to mpx.
media_mpx.http_handler_stack:
class: GuzzleHttp\HandlerStack
public: false
factory: GuzzleHttp\HandlerStack::create
configurator: ['@http_handler_stack_configurator', configure]
media_mpx.http_handler_stack_configurator:
class: Drupal\Core\Http\HandlerStackConfigurator
public: false
arguments: ['@service_container']
# This service is a generic client handling both authenticated and anonymous
# requests. Most code will want to use media_mpx.authenticated_client_factory
# instead.
media_mpx.client:
class: Lullabot\Mpx\Client
factory: media_mpx.client_factory:fromOptions
media_mpx.client_factory:
class: Drupal\media_mpx\ClientFactory
arguments: ['@media_mpx.http_handler_stack', '@http_client_factory', '@cache.media_mpx_http']
# Defines an array or memory cache that supports a limit on the number of
# items.
cache.backend.media_mpx.array_cache_pool:
class: Drupal\media_mpx\ArrayCachePoolFactory
arguments: ['@datetime.time', '@cache_tags.invalidator.checksum', 100]
# Use the above array cache on top of the normal HTTP request cache. We use
# the ChainedFastBackend cache so any invalidations on the consistent cache
# are shared with all threads.
cache.backend.media_mpx.chainedfast_http:
class: Drupal\Core\Cache\ChainedFastBackendFactory
arguments: ['@settings', null, 'cache.backend.media_mpx.array_cache_pool']
calls:
- [setContainer, ['@service_container']]
cache.media_mpx_http:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin , default_backend: cache.backend.media_mpx.chainedfast_http}
factory: cache_factory:get
arguments: [media_mpx_http]
# These services are "internal" and generally not needed by custom code.
media_mpx.session_lock:
class: Lullabot\DrupalSymfonyLock\DrupalStore
public: false
arguments: ['@lock']
# Factory for the \Drupal\Core\Cache\BackendChain class. Core does not ship
# with a factory for this class as it no longer uses this class itself.
# However, for the metadata cache (which holds the information Symfony uses
# to deserialize responses) we do not need a consistent cache since only a
# code change can invalidate the cache. Note that using ChainedFastBackend
# for the metadata cache incurs a significant performance hit, as every
# single call to invalidate cache tags invalidates the whole fast cache.
cache.backend.media_mpx.array_backend_chain:
class: Drupal\media_mpx\ArrayBackendChainFactory
arguments: ['@settings']
calls:
- [setContainer, ['@service_container']]
# The mpx-php library implements PSR-6, but there is only a PSR-16 cache
# adapter for Drupal. We use Symfony to bridge PSR-16 to PSR-6.
cache.media_mpx_metadata:
class: Drupal\Core\Cache\CacheBackendInterface
tags:
- { name: cache.bin, default_backend: cache.backend.media_mpx.array_backend_chain }
factory: cache_factory:get
arguments: [media_mpx_metadata]
media_mpx.simple_cache_backend_default:
class: HighWire\DrupalPSR16\Cache
public: false
arguments: ['@cache.default']
media_mpx.simple_cache_backend_metadata:
class: HighWire\DrupalPSR16\Cache
public: false
arguments: ['@cache.media_mpx_metadata']
media_mpx.token_cache_pool_adapter:
class: Symfony\Component\Cache\Adapter\SimpleCacheAdapter
public: false
arguments: ['@media_mpx.simple_cache_backend_default', 'media_mpx_token']
media_mpx.metadata_cache_pool_adapter:
class: Symfony\Component\Cache\Adapter\SimpleCacheAdapter
public: false
arguments: ['@media_mpx.simple_cache_backend_metadata', 'media_mpx_metadata']
media_mpx.token_cache_pool:
class: Lullabot\Mpx\TokenCachePool
public: false
arguments: ['@media_mpx.token_cache_pool_adapter']
media_mpx.event_subscriber:
class: Drupal\media_mpx\EventSubscriber\MediaMpxSubscriber
arguments: ['@messenger']
tags:
- { name: event_subscriber }
media_mpx.media_available_access:
class: Drupal\media_mpx\Access\MediaAvailableAccess
arguments: ['@datetime.time']
media_mpx.repository.mpx_media_types:
class: Drupal\media_mpx\Repository\MpxMediaType
arguments: ['@entity_type.manager']
media_mpx.service.queue_video_imports:
class: Drupal\media_mpx\Service\QueueVideoImports
arguments:
- '@media_mpx.repository.mpx_media_types'
- '@logger.channel.media_mpx'
- '@event_dispatcher'
- '@media_mpx.data_object_factory_creator'
- '@queue'
media_mpx.service.update_video_item:
class: Drupal\media_mpx\Service\UpdateVideoItem\UpdateVideoItem
arguments:
- '@media_mpx.repository.mpx_media_types'
- '@media_mpx.data_object_importer'
- '@media_mpx.data_object_factory_creator'
media_mpx.availability_summary:
class: Drupal\media_mpx\DateTime\AvailabilitySummary
arguments: ['@datetime.time', '@date.formatter']