github.com/NVIDIA/aistore@v1.3.23-0.20240517131212-7df6609be51d/api/apc/urlpaths.go (about)

     1  // Package apc: API control messages and constants
     2  /*
     3   * Copyright (c) 2021-2024, NVIDIA CORPORATION. All rights reserved.
     4   */
     5  package apc
     6  
     7  import "github.com/NVIDIA/aistore/cmn/cos"
     8  
     9  // RESTful URL path: l1/l2/l3
    10  const (
    11  	// l1
    12  	Version = "v1"
    13  	// l2
    14  	Buckets   = "buckets"
    15  	Objects   = "objects"
    16  	EC        = "ec"
    17  	Download  = "download"
    18  	Daemon    = "daemon"
    19  	Cluster   = "cluster"
    20  	Tokens    = "tokens"
    21  	Metasync  = "metasync"
    22  	Health    = "health"
    23  	Vote      = "vote"
    24  	ObjStream = "objstream"
    25  	MsgStream = "msgstream"
    26  	Reverse   = "reverse"
    27  	Rebalance = "rebalance"
    28  	Xactions  = "xactions"
    29  	S3        = "s3"
    30  	Txn       = "txn"      // 2PC
    31  	Notifs    = "notifs"   // intra-cluster notifications
    32  	Users     = "users"    // AuthN
    33  	Clusters  = "clusters" // AuthN
    34  	Roles     = "roles"    // AuthN
    35  	IC        = "ic"       // information center
    36  
    37  	// l3 ---
    38  
    39  	Voteres  = "result"
    40  	VoteInit = "init"
    41  	PriStop  = "primary-stopping"
    42  
    43  	// (see the corresponding action messages above)
    44  	Keepalive = "keepalive"
    45  	AdminJoin = "join-by-admin" // when node is joined by admin ("manual join")
    46  	SelfJoin  = "autoreg"       // auto-join cluster at startup
    47  
    48  	// target
    49  	Mountpaths = "mountpaths"
    50  
    51  	// common
    52  	Init     = "init"
    53  	Start    = "start"
    54  	Stop     = "stop"
    55  	Abort    = "abort"
    56  	Sort     = "sort"
    57  	Finished = "finished"
    58  	Progress = "progress"
    59  
    60  	// dsort, dloader, query
    61  	Metrics     = "metrics"
    62  	Records     = "records"
    63  	Shards      = "shards"
    64  	FinishedAck = "finished_ack"
    65  	UList       = "list"
    66  	Remove      = "remove"
    67  	Next        = "next"
    68  	Peek        = "peek"
    69  	Discard     = "discard"
    70  	WorkerOwner = "worker" // TODO: it should be removed once get-next-bytes endpoint is ready
    71  
    72  	// ETL
    73  	ETL        = "etl"
    74  	ETLInfo    = "info"
    75  	ETLList    = UList
    76  	ETLLogs    = "logs"
    77  	ETLObject  = "_object"
    78  	ETLStop    = Stop
    79  	ETLStart   = Start
    80  	ETLHealth  = "health"
    81  	ETLMetrics = "metrics"
    82  )
    83  
    84  // RESTful l3, internal use
    85  const (
    86  	SyncSmap = "syncsmap"
    87  )
    88  
    89  type URLPath struct {
    90  	L []string
    91  	S string
    92  }
    93  
    94  func urlpath(words ...string) URLPath {
    95  	return URLPath{L: words, S: cos.JoinWords(words[0], words[1:]...)}
    96  }
    97  
    98  var (
    99  	URLPathS3 = urlpath(S3) // URLPath{[]string{S3}, S3}
   100  
   101  	URLPathBuckets   = urlpath(Version, Buckets)
   102  	URLPathObjects   = urlpath(Version, Objects)
   103  	URLPathEC        = urlpath(Version, EC)
   104  	URLPathNotifs    = urlpath(Version, Notifs)
   105  	URLPathTxn       = urlpath(Version, Txn)
   106  	URLPathXactions  = urlpath(Version, Xactions)
   107  	URLPathIC        = urlpath(Version, IC)
   108  	URLPathHealth    = urlpath(Version, Health)
   109  	URLPathMetasync  = urlpath(Version, Metasync)
   110  	URLPathRebalance = urlpath(Version, Rebalance)
   111  
   112  	URLPathClu        = urlpath(Version, Cluster)
   113  	URLPathCluProxy   = urlpath(Version, Cluster, Proxy)
   114  	URLPathCluUserReg = urlpath(Version, Cluster, AdminJoin)
   115  	URLPathCluAutoReg = urlpath(Version, Cluster, SelfJoin)
   116  	URLPathCluKalive  = urlpath(Version, Cluster, Keepalive)
   117  	URLPathCluDaemon  = urlpath(Version, Cluster, Daemon)
   118  	URLPathCluSetConf = urlpath(Version, Cluster, ActSetConfig)
   119  	URLPathCluAttach  = urlpath(Version, Cluster, ActAttachRemAis)
   120  	URLPathCluDetach  = urlpath(Version, Cluster, ActDetachRemAis)
   121  
   122  	URLPathDae          = urlpath(Version, Daemon)
   123  	URLPathDaeProxy     = urlpath(Version, Daemon, Proxy)
   124  	URLPathDaeSetConf   = urlpath(Version, Daemon, ActSetConfig)
   125  	URLPathDaeAdminJoin = urlpath(Version, Daemon, AdminJoin)
   126  
   127  	URLPathReverse    = urlpath(Version, Reverse)
   128  	URLPathReverseDae = urlpath(Version, Reverse, Daemon)
   129  
   130  	URLPathVote        = urlpath(Version, Vote)
   131  	URLPathVoteInit    = urlpath(Version, Vote, Init)
   132  	URLPathVoteProxy   = urlpath(Version, Vote, Proxy)
   133  	URLPathVoteVoteres = urlpath(Version, Vote, Voteres)
   134  	URLPathVotePriStop = urlpath(Version, Vote, PriStop)
   135  
   136  	URLPathdSort        = urlpath(Version, Sort)
   137  	URLPathdSortInit    = urlpath(Version, Sort, Init)
   138  	URLPathdSortStart   = urlpath(Version, Sort, Start)
   139  	URLPathdSortList    = urlpath(Version, Sort, UList)
   140  	URLPathdSortAbort   = urlpath(Version, Sort, Abort)
   141  	URLPathdSortShards  = urlpath(Version, Sort, Shards)
   142  	URLPathdSortRecords = urlpath(Version, Sort, Records)
   143  	URLPathdSortMetrics = urlpath(Version, Sort, Metrics)
   144  	URLPathdSortAck     = urlpath(Version, Sort, FinishedAck)
   145  	URLPathdSortRemove  = urlpath(Version, Sort, Remove)
   146  
   147  	URLPathDownload       = urlpath(Version, Download)
   148  	URLPathDownloadAbort  = urlpath(Version, Download, Abort)
   149  	URLPathDownloadRemove = urlpath(Version, Download, Remove)
   150  
   151  	URLPathETL       = urlpath(Version, ETL)
   152  	URLPathETLObject = urlpath(Version, ETL, ETLObject)
   153  
   154  	URLPathTokens   = urlpath(Version, Tokens) // authn
   155  	URLPathUsers    = urlpath(Version, Users)
   156  	URLPathClusters = urlpath(Version, Clusters)
   157  	URLPathRoles    = urlpath(Version, Roles)
   158  )
   159  
   160  func (u URLPath) Join(words ...string) string {
   161  	return cos.JoinWords(u.S, words...)
   162  }