diff options
| author | Dan Engelbrecht <[email protected]> | 2024-06-04 22:21:06 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-06-04 22:21:06 +0200 |
| commit | 3a82e1cb3b5a284d2c47e03d541a35b84589314b (patch) | |
| tree | d4b6c3d7c548b2d6f83b105fb0a5668ca2152889 /src/zenstore/include | |
| parent | add batching of CacheStore requests for GetCacheValues/GetCacheChunks (#90) (diff) | |
| download | zen-3a82e1cb3b5a284d2c47e03d541a35b84589314b.tar.xz zen-3a82e1cb3b5a284d2c47e03d541a35b84589314b.zip | |
workspace share aliases (#91)
- Add `zen workspace-share` `--root-path` option - the root local file path of the workspace - if given it will automatically create the workspace before creating the share. If `--workspace` is omitted, an id will be generated from the `--root-path` parameter
- Add `/ws/share/{alias}/` endpoint - a shortcut to `/ws/{workspace_id}/{share_id}/` based endpoints using the alias for a workspace share
- Add `--alias` option to replace `--workspace` and `--share` options for `workspace-share` zen commands
- Rename `zen workspace create` `folder` option to `root-path`
- Rename `zen workspace create` `folder` option to `share-path`
Diffstat (limited to 'src/zenstore/include')
| -rw-r--r-- | src/zenstore/include/zenstore/workspaces.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/zenstore/include/zenstore/workspaces.h b/src/zenstore/include/zenstore/workspaces.h index e1a024894..2eacf313d 100644 --- a/src/zenstore/include/zenstore/workspaces.h +++ b/src/zenstore/include/zenstore/workspaces.h @@ -41,12 +41,18 @@ public: { Oid Id; std::filesystem::path RootPath; + inline bool operator==(const WorkspaceConfiguration& Rhs) const { return Id == Rhs.Id && RootPath == Rhs.RootPath; } }; struct WorkspaceShareConfiguration { Oid Id; std::filesystem::path SharePath; + std::string Alias; + inline bool operator==(const WorkspaceShareConfiguration& Rhs) const + { + return Id == Rhs.Id && SharePath == Rhs.SharePath && Alias == Rhs.Alias; + } }; struct WorkspaceInfo @@ -84,6 +90,14 @@ public: void WriteState(const std::filesystem::path& WorkspaceStatePath); void ReadState(const std::filesystem::path& WorkspaceStatePath, std::function<Oid(const std::filesystem::path& Path)>&& PathToIdCB); + struct ShareAlias + { + Oid WorkspaceId; + Oid ShareId; + }; + + std::optional<ShareAlias> GetShareAlias(std::string_view Alias) const; + private: LoggerRef& Log() { return m_Log; } @@ -95,6 +109,7 @@ private: LoggerRef m_Log; mutable RwLock m_Lock; tsl::robin_map<Oid, Ref<Workspace>, Oid::Hasher> m_Workspaces; + tsl::robin_map<std::string, ShareAlias> m_ShareAliases; }; void workspaces_forcelink(); |