MCPcopy Create free account
hub / github.com/cloudreve/cloudreve / NewEntitySource

Function NewEntitySource

pkg/filemanager/manager/entitysource/entitysource.go:200–232  ·  view source on GitHub ↗

NewEntitySource creates a new EntitySource.

(
	e fs.Entity,
	handler driver.Handler,
	policy *ent.StoragePolicy,
	generalAuth auth.Auth,
	settings setting.Provider,
	hasher hashid.Encoder,
	c request.Client,
	l logging.Logger,
	config conf.ConfigProvider,
	mime mime.MimeDetector,
	encryptorFactory encrypt.CryptorFactory,
	opts ...EntitySourceOption,
)

Source from the content-addressed store, hash-verified

198
199// NewEntitySource creates a new EntitySource.
200func NewEntitySource(
201 e fs.Entity,
202 handler driver.Handler,
203 policy *ent.StoragePolicy,
204 generalAuth auth.Auth,
205 settings setting.Provider,
206 hasher hashid.Encoder,
207 c request.Client,
208 l logging.Logger,
209 config conf.ConfigProvider,
210 mime mime.MimeDetector,
211 encryptorFactory encrypt.CryptorFactory,
212 opts ...EntitySourceOption,
213) EntitySource {
214 s := &entitySource{
215 e: e,
216 handler: handler,
217 policy: policy,
218 generalAuth: generalAuth,
219 settings: settings,
220 hasher: hasher,
221 c: c,
222 config: config,
223 l: l,
224 mime: mime,
225 encryptorFactory: encryptorFactory,
226 o: &EntitySourceOptions{},
227 }
228 for _, opt := range opts {
229 opt.Apply(s.o)
230 }
231 return s
232}
233
234func (f *entitySource) Apply(opts ...EntitySourceOption) {
235 if len(opts) > 0 {

Callers 7

UrlMethod · 0.92
UrlMethod · 0.92
GetDirectLinkMethod · 0.92
GetEntityUrlsMethod · 0.92
GetEntitySourceMethod · 0.92
CloneToLocalSrcMethod · 0.85

Calls 1

ApplyMethod · 0.65

Tested by

no test coverage detected