Documentation ¶
Index ¶
- Constants
- Variables
- func GetDiskQuota(ctx context.Context, prn string) (float64, error)
- func HasBackingFile(object *Object) (bool, error)
- func MakeStorageID(owner string, sha []byte) string
- func PantahubS3DevURL() string
- func SyncObjectSizes(obj *Object)
- type App
- func (a *App) FindObjectByShaByOwner(parentCtx context.Context, Sha, Owner string, obj *Object) error
- func (a *App) FindObjectByStorageID(parentCtx context.Context, storageID string, object *Object) error
- func (a *App) FindPublicObjectOwner(parentCtx context.Context, sha string, notOwnedBy string) (ownerStr string, err error)
- func (a *App) GetDiskQuota(pctx context.Context, prn string) (float64, error)
- func (a *App) LinkifyObject(ctx context.Context, object *Object) (linked bool, err error)
- func (a *App) ResolveObjectWithBacking(pctx context.Context, owner string, sha string) (*Object, error)
- func (a *App) ResolveObjectWithLinks(ctx context.Context, owner string, sha string, autoLink bool) (*Object, error)
- func (a *App) SaveObject(parentCtx context.Context, object *Object, localS3Check bool) (err error)
- type DiskQuotaUsageResult
- type Object
- type ObjectAccessClaims
- type ObjectAccessToken
- func NewFromValidToken(encodedToken string) (*ObjectAccessToken, error)
- func NewObjectAccessForSec(name string, method string, size int64, sha string, issuer string, ...) *ObjectAccessToken
- func NewObjectAccessToken(name string, method string, size int64, sha string, issuer string, ...) *ObjectAccessToken
- type ObjectWithAccess
Constants ¶
const ( HttpHeaderPantahubObjectType = "Pantahub-Object-Type" ObjectTypeLink = "link" ObjectTypeObject = "object" )
const (
// ObjectTokenValidSec expiration time for object token
ObjectTokenValidSec = 86400
)
Variables ¶
var ErrNoBackingFile = errors.New("No backing file nor link")
ErrNoBackingFile error signals that an object is not fully resolvable as it has no backing file yet.
var ErrNoLinkTargetAvail = errors.New("No link target available")
var ErrObjectS3PathAlreadyExists error = errors.New("local s3 file path for object is already exists")
ErrObjectS3PathAlreadyExists erro variable for "local s3 file path for object is already exists"
Functions ¶
func GetDiskQuota ¶
GetDiskQuota public function to get the default disk quota
func HasBackingFile ¶
func MakeStorageID ¶
MakeStorageID crerate a new storage ID
Types ¶
type App ¶
App objects rest application
func New ¶
func New(jwtMiddleware *jwt.JWTMiddleware, subService subscriptions.SubscriptionService, mongoClient *mongo.Client) *App
New create a new object rest application
func (*App) FindObjectByShaByOwner ¶
func (a *App) FindObjectByShaByOwner( parentCtx context.Context, Sha, Owner string, obj *Object, ) error
FindObjectByShaByOwner is to find object by sha & by owner
func (*App) FindObjectByStorageID ¶
func (a *App) FindObjectByStorageID(parentCtx context.Context, storageID string, object *Object) error
FindObjectByStorageID find object instance by _id
func (*App) FindPublicObjectOwner ¶
func (a *App) FindPublicObjectOwner(parentCtx context.Context, sha string, notOwnedBy string) ( ownerStr string, err error, )
FindPublicObjectOwner is to check if the object is used in any of the public steps, if yes return the owner string
func (*App) GetDiskQuota ¶
GetDiskQuota get disk quota for a object
func (*App) LinkifyObject ¶
LinkifyObject checks if there is any public object available to link and link if available
func (*App) ResolveObjectWithBacking ¶
func (*App) ResolveObjectWithLinks ¶
type DiskQuotaUsageResult ¶
DiskQuotaUsageResult payload for disk quota usage
type Object ¶
type Object struct { ID string `json:"id" bson:"id"` StorageID string `json:"storage-id" bson:"_id"` Owner string `json:"owner"` ObjectName string `json:"objectname"` Sha string `json:"sha256sum"` Size string `json:"size"` SizeInt int64 `json:"sizeint"` MimeType string `json:"mime-type"` LinkedObject string `json:"-" bson:"linked_object"` TimeCreated time.Time `json:"time-created" bson:"timecreated"` TimeModified time.Time `json:"time-modified" bson:"timemodified"` // contains filtered or unexported fields }
Object define a object structure
type ObjectAccessClaims ¶
type ObjectAccessClaims struct { jwt.StandardClaims DispositionName string Size int64 Method string // sha in hex encoding Sha string }
ObjectAccessClaims object claims for access
type ObjectAccessToken ¶
type ObjectAccessToken struct { // we use iss for identifying the trails endpoint // we use sub for identifying the requesting user wethat this claim was issued to // we use aud to identify the access URI in format: http://endpoint/storage-id // we use issued at for the time we issued this // we use use expires at for issuing time constrained grants *jwt.Token }
ObjectAccessToken access token for objects
func NewFromValidToken ¶
func NewFromValidToken(encodedToken string) (*ObjectAccessToken, error)
NewFromValidToken create a object token from another valid token
func NewObjectAccessForSec ¶
func NewObjectAccessForSec( name string, method string, size int64, sha string, issuer string, subject string, audience string, validSec int64) *ObjectAccessToken
NewObjectAccessForSec create new access token valid for a second
func NewObjectAccessToken ¶
func NewObjectAccessToken( name string, method string, size int64, sha string, issuer string, subject string, audience string, issuedAt int64, expiresAt int64) *ObjectAccessToken
NewObjectAccessToken Create new Object access token
func (*ObjectAccessToken) Sign ¶
func (o *ObjectAccessToken) Sign() (string, error)
Sign sign a access token
type ObjectWithAccess ¶
type ObjectWithAccess struct { Object `bson:",inline"` SignedPutURL string `json:"signed-puturl"` SignedGetURL string `json:"signed-geturl"` Now string `json:"now"` ExpireTime string `json:"expire-time"` }
ObjectWithAccess extends object to add access information
func GetObjectWithAccess ¶
func GetObjectWithAccess(object Object, endPoint string) *ObjectWithAccess
GetObjectWithAccess returns an ObjectWithAccess instance
func MakeObjAccessible ¶
func MakeObjAccessible(Issuer string, Subject string, obj Object, storageID string) ObjectWithAccess
MakeObjAccessible make a object accessible