diff --git a/src/3.AbstractBlobBase/base.jl b/src/3.AbstractBlobBase/base.jl index 7d697f9..c8598b0 100644 --- a/src/3.AbstractBlobBase/base.jl +++ b/src/3.AbstractBlobBase/base.jl @@ -34,30 +34,32 @@ Base.get!(f::Function, b::AbstractBlob, key) = Base.get!(f, getframe!(b), key) ## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- # TODO: Move to Absttract -# :set! :get :get! :dry +# :set! :get! :dry # all in ram -function withblob!(f::Function, rb::AbstractBlob, mode::Symbol, frame, key::String) +function withblob!(f::Function, b::AbstractBlob, mode::Symbol, frame, key::String) if mode == :set! val = f() - setindex!(rb, val, frame, key) - return blobyref(rb, frame, key; rT = typeof(val)) - end - if mode == :get - val = get(f, rb, frame, key) - return blobyref(rb, frame, key; rT = typeof(val)) + setindex!(b, val, frame, key) + return blobyref(b, frame, key; rT = typeof(val)) end + # TODO: Think about it + # What to do if 'frame, key' is missing + # if mode == :get + # val = get(f, b, frame, key) + # return blobyref(b, frame, key; rT = typeof(val)) + # end if mode == :get! - val = get!(f, rb, frame, key) - return blobyref(rb, frame, key; rT = typeof(val)) + val = get!(f, b, frame, key) + return blobyref(b, frame, key; rT = typeof(val)) end if mode == :dry val = f() - return blobyref(rb, frame, key; rT = typeof(val)) + return blobyref(b, frame, key; rT = typeof(val)) end error("Unknown mode, ", mode, ". see withblob! src") end -withblob!(f::Function, rb::AbstractBlob, mode::Symbol, key::String) = - withblob!(f, rb, mode, BLOBBATCH_DEFAULT_FRAME_NAME, key) +withblob!(f::Function, b::AbstractBlob, mode::Symbol, key::String) = + withblob!(f, b, mode, BLOBBATCH_DEFAULT_FRAME_NAME, key) ## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- @@ -68,19 +70,19 @@ getframe(b::AbstractBlob) = getframe(b, BLOBBATCH_DEFAULT_FRAME_NAME) ## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- # lock import Base.lock -Base.lock(f::Function, rb::AbstractBlob; kwargs...) = _lock(f, rb; kwargs...) -Base.lock(rb::AbstractBlob; kwargs...) = _lock(rb; kwargs...) +Base.lock(f::Function, b::AbstractBlob; kwargs...) = _lock(f, b; kwargs...) +Base.lock(b::AbstractBlob; kwargs...) = _lock(b; kwargs...) import Base.islocked -Base.islocked(rb::AbstractBlob) = _islocked(rb) +Base.islocked(b::AbstractBlob) = _islocked(b) import Base.unlock -Base.unlock(rb::AbstractBlob; force = false) = _unlock(rb; force) +Base.unlock(b::AbstractBlob; force = false) = _unlock(b; force) ## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.- # blobyref -blobyref(rb::AbstractBlob, key; rT = nothing) = - blobyref(rb, BLOBBATCH_DEFAULT_FRAME_NAME, key; rT) +blobyref(b::AbstractBlob, key; rT = nothing) = + blobyref(b, BLOBBATCH_DEFAULT_FRAME_NAME, key; rT) ## --.--. - .-. .- .--.-.- .- .---- ... . .-.-.-.-