github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/api/apc/headers.go (about) 1 // Package apc: API control messages and constants 2 /* 3 * Copyright (c) 2018-2024, NVIDIA CORPORATION. All rights reserved. 4 */ 5 package apc 6 7 import "strings" 8 9 // AIS http header conventions: 10 // - always starts with the prefix "ais-" 11 // - all words separated with "-" 12 // - no '.' periods, no underscores. 13 // For standard and provider-specific HTTP headers, see cmn/cos/const_http.go 14 15 const HdrError = "Hdr-Error" 16 17 const ( 18 HeaderPrefix = "ais-" 19 20 // bucket inventory - an alternative way to list (very large) buckets 21 HdrInventory = HeaderPrefix + "bucket-inventory" // must be present and must be "true" (or "y", "yes", "on" case-insensitive) 22 HdrInvName = HeaderPrefix + "inv-name" // optional; name of the inventory (to override the system default) 23 HdrInvID = HeaderPrefix + "inv-id" // optional; inventory ID (ditto) 24 25 // GET via x-blob-download 26 HdrBlobDownload = HeaderPrefix + ActBlobDl // must be present and must be "true" (or "y", "yes", "on" case-insensitive) 27 HdrBlobChunk = HeaderPrefix + "blob-chunk" // optional; e.g., 1mb, 2MIB, 3m, or 1234567 (bytes) 28 HdrBlobWorkers = HeaderPrefix + "blob-workers" // optional; the default number of workers is dfltNumWorkers in xs/blob_download.go 29 30 // Bucket props headers 31 HdrBucketProps = HeaderPrefix + "bucket-props" // => cmn.Bprops 32 HdrBucketSumm = HeaderPrefix + "bucket-summ" // => cmn.BsummResult (see also: QparamFltPresence) 33 HdrBucketVerEnabled = HeaderPrefix + "versioning-enabled" // Enable/disable object versioning in a bucket. 34 HdrBackendProvider = HeaderPrefix + "provider" // ProviderAmazon et al. - see cmn/bck.go. 35 36 // including BucketProps.Extra.AWS 37 HdrS3Region = HeaderPrefix + "cloud_region" 38 HdrS3Endpoint = HeaderPrefix + "endpoint" 39 HdrS3Profile = HeaderPrefix + "profile" 40 41 // including BucketProps.Extra.HTTP 42 HdrOrigURLBck = HeaderPrefix + "original-url" 43 44 // remote AIS 45 HdrRemAisUUID = HeaderPrefix + "remote-ais-uuid" 46 HdrRemAisAlias = HeaderPrefix + "remote-ais-alias" 47 HdrRemAisURL = HeaderPrefix + "remote-ais-url" 48 49 HdrRemoteOffline = HeaderPrefix + "remote-offline" // When accessing cached remote bucket with no backend connectivity. 50 51 // Object props headers 52 HdrObjCksumType = HeaderPrefix + "checksum-type" // Checksum type, one of SupportedChecksums(). 53 HdrObjCksumVal = HeaderPrefix + "checksum-value" // Checksum value. 54 HdrObjAtime = HeaderPrefix + "atime" // Object access time. 55 HdrObjCustomMD = HeaderPrefix + "custom-md" // Object custom metadata. 56 HdrObjVersion = HeaderPrefix + "version" // Object version/generation - ais or cloud. 57 58 // Append object header. 59 HdrAppendHandle = HeaderPrefix + "append-handle" 60 61 // api.PutApndArchArgs message flags 62 HdrPutApndArchFlags = HeaderPrefix + "pine" 63 64 // Query objects handle header. 65 HdrHandle = HeaderPrefix + "query-handle" 66 67 // Reverse proxy headers. 68 HdrNodeID = HeaderPrefix + "node-id" 69 HdrNodeURL = HeaderPrefix + "node-url" 70 71 // uptimes, respectively 72 HdrNodeUptime = HeaderPrefix + "node-uptime" 73 HdrClusterUptime = HeaderPrefix + "cluster-uptime" 74 ) 75 76 // AuthN consts 77 const ( 78 HdrAuthorization = "Authorization" // https://developer.mozilla.org/en-US/docs/Web/HTTP/Hdrs/Authorization 79 AuthenticationTypeBearer = "Bearer" 80 ) 81 82 // Internally used headers 83 const ( 84 HdrCallerID = HeaderPrefix + "caller-id" // Marker of intra-cluster request. 85 HdrT2TPutterID = HeaderPrefix + "putter-id" // DaemonID of the target that performs intra-cluster PUT 86 HdrCallerName = HeaderPrefix + "caller-name" 87 HdrCallerIsPrimary = HeaderPrefix + "caller-is-primary" 88 HdrCallerSmapVer = HeaderPrefix + "caller-smap-ver" 89 90 HdrXactionID = HeaderPrefix + "xaction-id" 91 92 // Stream related headers. 93 HdrSessID = HeaderPrefix + "session-id" 94 HdrCompress = HeaderPrefix + "compress" // LZ4Compression, etc. 95 96 // Promote(dir) 97 HdrPromoteNamesHash = HeaderPrefix + "promote-names-hash" 98 HdrPromoteNamesNum = HeaderPrefix + "promote-names-num" 99 ) 100 101 // 102 // convert prop name to HTTP header tag name 103 // 104 105 func PropToHeader(prop string) string { 106 if strings.HasPrefix(prop, HeaderPrefix) { 107 return prop 108 } 109 if prop[0] == '.' || prop[0] == '_' { 110 prop = prop[1:] 111 } 112 prop = strings.ReplaceAll(prop, ".", "-") 113 prop = strings.ReplaceAll(prop, "_", "-") 114 return HeaderPrefix + prop 115 }