File: options.yaml

package info (click to toggle)
golang-github-lestrrat-go-httprc 1.0.6-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 168 kB
  • sloc: perl: 56; sh: 6; makefile: 2
file content (119 lines) | stat: -rw-r--r-- 4,868 bytes parent folder | download
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
package_name: httprc
output: options_gen.go
interfaces:
  - name: RegisterOption
    comment: |
      RegisterOption desribes options that can be passed to `(httprc.Cache).Register()`
  - name: CacheOption
    comment: |
      CacheOption desribes options that can be passed to `New()`
  - name: FetcherOption
    methods:
      - cacheOption
    comment: |
      FetcherOption describes options that can be passed to `(httprc.Fetcher).NewFetcher()`
  - name: FetchOption
    comment: |
      FetchOption describes options that can be passed to `(httprc.Fetcher).Fetch()`
  - name: FetchRegisterOption
    methods:
      - fetchOption
      - registerOption
  - name: FetchFetcherRegisterOption
    methods:
      - fetchOption
      - fetcherOption
      - registerOption
options:
  - ident: FetcherWorkerCount
    interface: FetcherOption
    argument_type: int
    comment: |
      WithFetchWorkerCount specifies the number of HTTP fetch workers that are spawned
      in the backend. By default 3 workers are spawned.
  - ident: Whitelist
    interface: FetchFetcherRegisterOption
    argument_type: Whitelist
    comment: |
      WithWhitelist specifies the Whitelist object that can control which URLs are
      allowed to be processed.

      It can be passed to `httprc.NewCache` as a whitelist applied to all
      URLs that are fetched by the cache, or it can be passed on a per-URL
      basis using `(httprc.Cache).Register()`. If both are specified,
      the url must fulfill _both_ the cache-wide whitelist and the per-URL
      whitelist.
  - ident: Transformer
    interface: RegisterOption
    argument_type: Transformer
    comment: |
      WithTransformer specifies the `httprc.Transformer` object that should be applied
      to the fetched resource. The `Transform()` method is only called if the HTTP request
      returns a `200 OK` status.
  - ident: HTTPClient
    interface: FetchRegisterOption
    argument_type: HTTPClient
    comment: |
      WithHTTPClient specififes the HTTP Client object that should be used to fetch
      the resource. For example, if you need an `*http.Client` instance that requires
      special TLS or Authorization setup, you might want to pass it using this option.
  - ident: MinRefreshInterval
    interface: RegisterOption
    argument_type: time.Duration
    comment: |
      WithMinRefreshInterval specifies the minimum refresh interval to be used.

      When we fetch the key from a remote URL, we first look at the `max-age`
      directive from `Cache-Control` response header. If this value is present,
      we compare the `max-age` value and the value specified by this option
      and take the larger one (e.g. if `max-age` = 5 minutes and `min refresh` = 10
      minutes, then next fetch will happen in 10 minutes)

      Next we check for the `Expires` header, and similarly if the header is
      present, we compare it against the value specified by this option,
      and take the larger one.

      Finally, if neither of the above headers are present, we use the
      value specified by this option as the interval until the next refresh.

      If unspecified, the minimum refresh interval is 1 hour.

      This value and the header values are ignored if `WithRefreshInterval` is specified.
  - ident: RefreshInterval
    interface: RegisterOption
    argument_type: time.Duration
    comment: |
      WithRefreshInterval specifies the static interval between refreshes
      of resources controlled by `httprc.Cache`.

      Providing this option overrides the adaptive token refreshing based
      on Cache-Control/Expires header (and `httprc.WithMinRefreshInterval`),
      and refreshes will *always* happen in this interval.

      You generally do not want to make this value too small, as it can easily
      be considered a DoS attack, and there is no backoff mechanism for failed
      attempts.
  - ident: RefreshWindow
    interface: CacheOption
    argument_type: time.Duration
    comment: |
      WithRefreshWindow specifies the interval between checks for refreshes.
      `httprc.Cache` does not check for refreshes in exact intervals. Instead,
      it wakes up at every tick that occurs in the interval specified by
      `WithRefreshWindow` option, and refreshes all entries that need to be
      refreshed within this window.

      The default value is 15 minutes.

      You generally do not want to make this value too small, as it can easily
      be considered a DoS attack, and there is no backoff mechanism for failed
      attempts.
  - ident: ErrSink
    interface: CacheOption
    argument_type: ErrSink
    comment: |
      WithErrSink specifies the `httprc.ErrSink` object that handles errors
      that occurred during the cache's execution. For example, you will be
      able to intercept errors that occurred during the execution of Transformers.