Utilitaire pour indexer des informations de la blockchain et dessiner des Plots. Focalisé sur la toile de confiance. http://datajune.coinduf.eu/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.3 KiB

module Config
"exports constants and create folder architecture"
export DATA_PATH, CHUNK_PATH, API_PATH, CACHE_PATH, IMAGE_CACHE_PATH, STORAGE_CACHE_FILE, CHUNK_SIZE, block_to_chunk, local_chunk, chunkfile, SAMPLING_PERIOD, CERTVALIDITY, CHUNKSERVER_URL, BMA_URL, LG_PATH, GLOBAL_PATH, WOTSTATS_CACHE_FILE, PLOTS_PATH, COORD_PATH, JSON_GRAPH_PATH, WOTFRAME_CACHE_FILE, MAPPED_PATH
# local folder architecture
const DATA_PATH = "data"
const CHUNK_PATH = joinpath(DATA_PATH, "chunks")
const API_PATH = joinpath(DATA_PATH, "data")
const CACHE_PATH = "cache"
const IMAGE_CACHE_PATH = joinpath(CACHE_PATH, "img")
const STORAGE_CACHE_FILE = joinpath(CACHE_PATH, "storage.jls")
const WOTSTATS_CACHE_FILE = joinpath(CACHE_PATH, "wotstats.jls")
const WOTFRAME_CACHE_FILE = joinpath(CACHE_PATH, "wotframe.jls")
const LG_PATH = joinpath(DATA_PATH, "graphs.lg")
const JSON_GRAPH_PATH = joinpath(DATA_PATH, "graphs.json")
const GLOBAL_PATH = joinpath(DATA_PATH, "global")
const PLOTS_PATH = joinpath(DATA_PATH, "plots")
const COORD_PATH = joinpath(DATA_PATH, "coords")
const MAPPED_PATH = joinpath(DATA_PATH, "mapped") # data only about active members mapped onto global ids
# create folders
mkpath(CHUNK_PATH)
mkpath(DATA_PATH)
mkpath(API_PATH)
mkpath(CACHE_PATH)
mkpath(IMAGE_CACHE_PATH)
mkpath(LG_PATH)
mkpath(JSON_GRAPH_PATH)
mkpath(GLOBAL_PATH)
mkpath(PLOTS_PATH)
mkpath(COORD_PATH)
mkpath(MAPPED_PATH)
# constants and utility linked to it
const CHUNK_SIZE = 250 # number of blocks in a chunk
block_to_chunk(n::Int) = n ÷ CHUNK_SIZE # chunk number of block number n
local_chunk() = length(readdir(CHUNK_PATH)) - 1 # chunk number of last chunk
chunkfile(n::Int) = joinpath(CHUNK_PATH, "chunk_$n-250.json") # filename of chunk number n
graphfile(n::Int) = lpad(string(n),4,'0')*".lg"
const SAMPLING_PERIOD = 3600 * 24 # sampling period in seconds
const CERTVALIDITY = 3600 * 24 * 365 * 2 # validity of certification in seconds (2 years)
const CHUNKSERVER_URL = "http://datajune.coinduf.eu/chunks/"
BMA_URL = "https://duniter.coinduf.eu/"
# BMA_URL = "https://panoramix.toutat.is/"
# BMA_URL = "https://g1.cgeek.fr/"
# BMA_URL = "https://g1.computhings.be/"
# BMA_URL = "https://leforgeur.net/"
# BMA_URL = "https://g1.librelois.fr/"
# BMA_URL = "http://duniter.moul.re/"
# BMA_URL = "https://g1.altastella.eu/"
# BMA_URL = "https://g1.halpanet.org/"
end