class StoreAgent::Workspace

ワークスペース

Attributes

current_user[R]
namespace[R]
version_manager[R]

Public Class Methods

name_list() click to toggle source

全ワークスペース名の一覧を配列で返す

# File lib/store_agent/workspace.rb, line 79
def self.name_list
  if !File.exists?(StoreAgent.config.storage_root)
    FileUtils.mkdir_p(StoreAgent.config.storage_root)
  end
  FileUtils.cd(StoreAgent.config.storage_root) do
    return Dir.glob("*", File::FNM_DOTMATCH) - StoreAgent.reserved_filenames
  end
end

Public Instance Methods

create() click to toggle source

ワークスペースを新規作成する

# File lib/store_agent/workspace.rb, line 36
def create
  if exists?
    raise InvalidPathError, "workspace #{@namespace} is already exists"
  end
  FileUtils.mkdir_p(namespace_dirname)
  @version_manager.init
  root.create
end
delete() click to toggle source

ワークスペースを削除する

# File lib/store_agent/workspace.rb, line 46
def delete
  if !exists?
    raise InvalidPathError, "workspace #{@namespace} not found"
  end
  FileUtils.remove_dir(namespace_dirname)
end
metadata_dirname() click to toggle source

メタデータの保存に使用する領域の絶対パス

# File lib/store_agent/workspace.rb, line 69
def metadata_dirname
  File.absolute_path("#{namespace_dirname}/#{StoreAgent.config.metadata_dirname}")
end
namespace_dirname() click to toggle source

ワークスペースの絶対パス

# File lib/store_agent/workspace.rb, line 59
def namespace_dirname
  File.absolute_path("#{StoreAgent.config.storage_root}/#{@namespace}")
end
permission_dirname() click to toggle source

権限情報の保存に使用する領域の絶対パス

# File lib/store_agent/workspace.rb, line 74
def permission_dirname
  File.absolute_path("#{namespace_dirname}/#{StoreAgent.config.permission_dirname}")
end
root() click to toggle source

ワークスペースのファイルツリーの最上位ノード

# File lib/store_agent/workspace.rb, line 54
def root
  @root ||= StoreAgent::Node::DirectoryObject.new(workspace: self, path: "/")
end
storage_dirname() click to toggle source

ストレージとして使用する領域の絶対パス

# File lib/store_agent/workspace.rb, line 64
def storage_dirname
  File.absolute_path("#{namespace_dirname}/#{StoreAgent.config.storage_dirname}")
end