Wsdataselect.DataFile (wsdataselect v1.1.22)

Copy Markdown View Source

Module to manipulate files in the storage repository.

Summary

Types

t()

An archive structure. tsindex is a list of maps stored in json ie. [{"offset": 0, "timestamp": 1111}]

Functions

Returns the full path of the file, where it can be read. Includes the mountpoint set in the application config, the name of the repository as subdirectory And the path of the file.

Returns the path with the offset, in a syntax that dataselect understands.

Test the repositories. Gets a list of repositories, list the expected mount point for each of them.

Find the best fitting offsets (start and end). Timeindex is expected to be like: [ %{"offset" => 0, "timestamp" => 533174407868300000} ]

Types

t()

@type t() :: %Wsdataselect.DataFile{
  cha: String.t(),
  checksum: DateTime.t(),
  earliest: DateTime.t(),
  end_offset: integer(),
  extnet: String.t(),
  latest: DateTime.t(),
  loc: String.t(),
  net: String.t(),
  path: String.t(),
  quality: String.t(),
  repository: String.t(),
  source_id: String.t(),
  sta: String.t(),
  start_offset: integer(),
  tsindex: list(),
  updated: DateTime.t()
}

An archive structure. tsindex is a list of maps stored in json ie. [{"offset": 0, "timestamp": 1111}]

Functions

abs_path(file)

@spec abs_path(t()) :: String.t()

Returns the full path of the file, where it can be read. Includes the mountpoint set in the application config, the name of the repository as subdirectory And the path of the file.

abs_path_with_offset(file)

@spec abs_path_with_offset(t()) :: String.t()

Returns the path with the offset, in a syntax that dataselect understands.

exists?(file)

@spec exists?(t()) :: boolean()

get_end_offset(file, ts)

@spec get_end_offset(t(), integer()) :: integer()

get_file_size(file)

@spec get_file_size(t()) :: integer()

get_start_offset(file, ts)

@spec get_start_offset(t(), integer()) :: integer()

health()

@spec health() :: {:ok | :warning | :error, String.t()}

Test the repositories. Gets a list of repositories, list the expected mount point for each of them.

Return

A tupple: {:ok, message} if all repositories are accessible

set_offsets(file)

@spec set_offsets(t()) :: t()

Find the best fitting offsets (start and end). Timeindex is expected to be like: [ %{"offset" => 0, "timestamp" => 533174407868300000} ]