Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 
 

36 rader
1008 B

  1. package storage
  2. import (
  3. "io"
  4. "time"
  5. )
  6. type Metadata struct {
  7. // ContentType is the original uploading content type
  8. ContentType string
  9. // ContentLength contains the length of the actual object
  10. ContentLength int64
  11. // Downloads is the actual number of downloads
  12. Downloads int
  13. // MaxDownloads contains the maximum numbers of downloads
  14. MaxDownloads int
  15. // MaxDate contains the max age of the file
  16. MaxDate time.Time
  17. // DeletionToken contains the token to match against for deletion
  18. DeletionToken string
  19. // Secret as knowledge to delete file
  20. Secret string
  21. }
  22. type Storage interface {
  23. Get(token string, filename string) (reader io.ReadCloser, metaData Metadata, err error)
  24. Head(token string, filename string) (metadata Metadata, err error)
  25. Meta(token string, filename string, metadata Metadata) error
  26. Put(token string, filename string, reader io.Reader, metadata Metadata) error
  27. Delete(token string, filename string) error
  28. IsNotExist(err error) bool
  29. DeleteExpired() error
  30. Type() string
  31. }