@@ -27,12 +27,14 @@
Loading
27 27
# Make sure we can load stdlibs
28 28
!in("@stdlib", LOAD_PATH) && push!(LOAD_PATH, "@stdlib")
29 29
30 -
using Serialization, Pkg, SHA
30 +
using Pkg, SHA
31 31
using Base: UUID
32 32
33 33
include("faketypes.jl")
34 34
include("symbols.jl")
35 35
include("utils.jl")
36 +
include("serialize.jl")
37 +
using .CacheStore
36 38
37 39
store_path = length(ARGS) > 0 ? ARGS[1] : abspath(joinpath(@__DIR__, "..", "store"))
38 40
@@ -75,7 +77,7 @@
Loading
75 77
76 78
function write_cache(name, pkg)
77 79
    open(joinpath(server.storedir, name), "w") do io
78 -
        serialize(io, pkg)
80 +
        CacheStore.write(io, pkg)
79 81
    end
80 82
end
81 83
@@ -110,7 +112,7 @@
Loading
110 112
    if isfile(cache_path)
111 113
        if is_package_deved(ctx.env.manifest, uuid)
112 114
            cached_version = open(cache_path) do io
113 -
                deserialize(io)
115 +
                CacheStore.read(io)
114 116
            end
115 117
            if sha_pkg(frommanifest(ctx.env.manifest, uuid)) != cached_version.sha
116 118
                @info "Outdated sha, will recache package $pk_name ($uuid)"
@@ -147,7 +149,7 @@
Loading
147 149
    end
148 150
end
149 151
150 -
symbols(env_symbols, nothing, SymbolServer.getallns(), visited)
152 +
symbols(env_symbols, nothing, getallns(), visited)
151 153
152 154
# Wrap the `ModuleStore`s as `Package`s.
153 155
for (pkg_name, cache) in env_symbols
@@ -155,7 +157,7 @@
Loading
155 157
    !isinmanifest(ctx, pkg_name) && continue
156 158
    uuid = packageuuid(ctx, String(pkg_name))
157 159
    pe = frommanifest(ctx, uuid)
158 -
    server.depot[uuid] = Package(String(pkg_name), cache, version(pe), uuid, sha_pkg(pe))
160 +
    server.depot[uuid] = Package(String(pkg_name), cache, uuid, sha_pkg(pe))
159 161
end
160 162
161 163
# Write to disc

@@ -26,11 +26,10 @@
Loading
26 26
struct Package
27 27
    name::String
28 28
    val::ModuleStore
29 -
    ver::Any
30 29
    uuid::Base.UUID
31 -
    sha
30 +
    sha::Union{Vector{UInt8},Nothing}
32 31
end
33 -
Package(name::String, val::ModuleStore, ver, uuid::String, sha) = Package(name, val, ver, Base.UUID(uuid), sha)
32 +
Package(name::String, val::ModuleStore, uuid::String, sha) = Package(name, val, Base.UUID(uuid), sha)
34 33
35 34
struct MethodStore
36 35
    name::Symbol
@@ -548,7 +547,7 @@
Loading
548 547
    end
549 548
end
550 549
551 -
getallns() = let allns = Base.IdSet{Symbol}(); SymbolServer.oneverything((m, s, x, state) -> push!(allns, s)); allns end
550 +
getallns() = let allns = Base.IdSet{Symbol}(); oneverything((m, s, x, state) -> push!(allns, s)); allns end
552 551
553 552
"""
554 553
    split_module_names(m::Module, allns)

@@ -1,6 +1,6 @@
Loading
1 1
module CacheStore
2 -
using SymbolServer: VarRef, FakeTypeName, FakeTypeofBottom, FakeTypeVar, FakeUnion, FakeUnionAll
3 -
using SymbolServer: ModuleStore, Package, FunctionStore, MethodStore, DataTypeStore, GenericStore
2 +
using ..SymbolServer: VarRef, FakeTypeName, FakeTypeofBottom, FakeTypeVar, FakeUnion, FakeUnionAll
3 +
using ..SymbolServer: ModuleStore, Package, FunctionStore, MethodStore, DataTypeStore, GenericStore
4 4
5 5
const NothingHeader = 0x01
6 6
const SymbolHeader = 0x02
@@ -141,13 +141,13 @@
Loading
141 141
    write_vector(io, x.used_modules)
142 142
end
143 143
144 -
# function write(io, x::Package)
145 -
#     Base.write(io, PackageHeader)
146 -
#     write(io, x.name)
147 -
#     write(io, x.val)
148 -
#     write(io, x.doc)
149 -
#     write(io, x.exported)
150 -
# end
144 +
function write(io, x::Package)
145 +
    Base.write(io, PackageHeader)
146 +
    write(io, x.name)
147 +
    write(io, x.val)
148 +
    Base.write(io, UInt128(x.uuid))
149 +
    Base.write(io, x.sha === nothing ? zeros(UInt8, 32) : x.sha)
150 +
end
151 151
152 152
function write_vector(io, x)
153 153
    Base.write(io, length(x))
@@ -225,15 +225,20 @@
Loading
225 225
    elseif t === TupleHeader
226 226
        N = Base.read(io, Int)
227 227
        ntuple(i->read(io), N)
228 +
    elseif t === PackageHeader
229 +
        name = read(io)
230 +
        val = read(io)
231 +
        uuid = Base.UUID(Base.read(io, UInt128))
232 +
        sha = Base.read(io, 32)
233 +
        Package(name, val, uuid, all(x == 0x00 for x in sha) ? nothing : sha)
228 234
    else
229 -
        error("HIYA")
235 +
        error("HIYA: $t")
230 236
    end
231 237
end
232 238
233 239
function read_vector(io, T)
234 240
    n = Base.read(io, Int)
235 241
    v = T[]
236 -
    # v = Array{T}(undef, n)
237 242
    for i = 1:n
238 243
        push!(v, read(io))
239 244
    end

@@ -385,7 +385,6 @@
Loading
385 385
386 386
recursive_copy(p::Package) = Package(p.name,
387 387
                                     recursive_copy(p.val),
388 -
                                     recursive_copy(p.ver),
389 388
                                     p.uuid,
390 389
                                     recursive_copy(p.sha))
391 390

@@ -2,7 +2,7 @@
Loading
2 2
3 3
export SymbolServerInstance, getstore
4 4
5 -
using Serialization, Pkg, SHA
5 +
using Pkg, SHA
6 6
using Base: UUID, Process
7 7
import Sockets, UUIDs
8 8
@@ -10,6 +10,7 @@
Loading
10 10
include("symbols.jl")
11 11
include("utils.jl")
12 12
include("serialize.jl")
13 +
using .CacheStore
13 14
14 15
mutable struct SymbolServerInstance
15 16
    process::Union{Nothing,Base.Process}
@@ -170,7 +171,7 @@
Loading
170 171
    if isfile(cache_path)
171 172
        try
172 173
            package_data = open(cache_path) do io
173 -
                deserialize(io)
174 +
                CacheStore.read(io)
174 175
            end
175 176
            store[Symbol(pe_name)] = package_data.val
176 177
            for dep in deps(pe)
Files Coverage
src 73.60%
Project Totals (6 files) 73.60%
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests
codecov-umbrella
Build #237339906 -
unittests

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading